我已经声明了一个常量头文件:“ Constants.h”。它包含以下声明:
extern const NSString *Const_alertPayantMessage = @"test";
extern const NSString *Const_alertPayantTitle = @"Wooooops!!!";
extern const int *Const_statutPayant = 1;
我以这种方式使用了这些常量:
int x = 1;
if (x == Const_statutPayant) {
UIAlertView* mes=[[UIAlertView alloc] initWithTitle:Const_alertPayantTitle
message:Const_alertPayantMessage delegate:self cancelButtonTitle:@"Ok" otherButtonTitles: nil];
[mes show];
[avPlayerError play];
}else{
[avPlayer play];
不幸的是,我无法运行我的应用程序,因为我收到以下错误消息:
clang: error: linker command failed with exit code 1 (use -v to see invocation)
你有什么主意吗
最佳答案
“ Constants.h”应包含:
extern const NSString *Const_alertPayantMessage;
extern const NSString *Const_alertPayantTitle;
extern const int Const_statutPayant;
“ Constants.m”应包含:
const NSString *Const_alertPayantMessage = @"test";
const NSString *Const_alertPayantTitle = @"Wooooops!!!";
const int Const_statutPayant = 1;
关于ios - iOS:与“Constants.h”有关的错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/15947494/