I tried to import the .m file to use the static variable declared there in another class.
#import "Faculty.m"
I received the error message "There is no such file or directory." Now it may be a bad programming practice to declare variables in .m implementation files, but just out of curiosity, what kind of error is this? Does the .m file really exist? Why "No such file" then?
, , , *.hmap, . Xcode *.h.
(, , " "), *.m , , #import.
, .m - , , , , . , Faculty.m , .
, , , . , , , , . , , , #include #import - . , Faculty.m "foo", Student.m Administrator.m, Faculty.m "foo", Student.m "foo" Administrator.m "foo".
#include
#import
, , - Faculty.m, extern Faculty.h .m, import Faculty.h.
extern
:
#import "Faculty.h"
Falculty:
// Faculty.h @interface Faculty : NSObject { } + (VarType*)variable; + (void)setVariable:(VarType*)newVariable; @end // Faculty.m #import "Faculty.h" static VarType* variable; @implementation Faculty + (VarType*)variable { return variable; } + (void)setVariable:(VarType*)newVariable { if (variable != newVariable) { [variable release]; variable = [newVariable copy]; } } @end
Usually ".m" files (module) are not imported. Instead, you import the ".h" files (header), which contain class and method declarations. They contain enough information to give the compiler an idea of how to make everything work.
Source: https://habr.com/ru/post/1776560/More articles:https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1776555/openinputdesktop-to-determine-securelogin-desktop&usg=ALkJrhj_q3K9993TCpTwAF5MhuLRKO8WHwEasy selection inside Oracle stored procedure - oracleI need Eclipse to deploy a WAR file, my ANT script builds, and not what it builds from the inside - eclipsehttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1776558/converting-javascript-generated-documentspages-to-pdf&usg=ALkJrhi3CFQR7ezJ9xcylH7VYU7HNv0xPgEntity Framework - dependent objects not deleted to the main object when a cascade deleting compound key objects - entity-frameworkPDF/A-1a: OutputIntents для черно-белых изображений - pdfSort an array of cells by the first element of each cell - matlabHow to reverse a given sentence (string) in C ++? - c ++OpenSSL Peer Certificate Validation (Client) in C ++ - c ++Why is SharePoint not correctly distributing my HTML and CSS content? - htmlAll Articles