报错:Undefined symbols for architecture ...

转自:http://beta.wikiversity.org/wiki/Topic:iOS/KB/%E7%BC%96%E8%AF%91%E9%94%99%E8%AF%AF

示例:

   Undefined symbols for architecture armv7:
   "_OBJC_CLASS_$_MFMessageComposeViewController", referenced from:
   l_OBJC_$_CATEGORY_MFMessageComposeViewController_$_BlocksKit in BlocksKit(BlocksKit)

原因:

这是编译器找不到符号定义,通常这意味着某些framework没有加入项目中

解决参考:

解读信息,是因为找不到叫MFMessageComposeViewController的ObjC类。
查找MFMessageComposeViewController的信息,得知其定义在MessageUI.framework中,将其加入到项目中即可


Receiver 'ClassName' for class message is a forward declaration

相似的还有:Receiver type 'ClassName' for instance message is a forward declaration

可能原因:

解决参考:

类是用 @class 方式引用的?尝试在实现部分用 #import 方式引用。


多语言混编错误

多语言混编处理不当可能会引起:

  • Expected * before *: Expected '=',',',';','asm' or '__attribute' before '<' token
  • LLVM GCC 4.2 Error: Cannot find protocol declaration for 'class'
  • 待补充

可能原因:

文件处理不当(同一个文件混用多种语言的写法,后缀设置不当,如ObjC++文件没用.mm后缀)导致编译器判断语言出错

解决参考:

如果能改好文件的话,那就改正吧。否则可以尝试强制编译器按指定类型编译。(http://beta.wikiversity.org/wiki/Topic:iOS/KB/%E5%BC%BA%E5%88%B6%E7%BC%96%E8%AF%91%E6%96%87%E4%BB%B6%E7%B1%BB%E5%9E%8B)

Undefined symbols for architecture x86_64

05-02

Ld /Users/Lawrence/Library/Developer/Xcode/DerivedData/TempProject-gsfqekbhfijequcmtomvccfjafol/Build/Products/Debug/TempProject normal x86_64rn cd "/Users/Lawrence/workspace/Xcode Workspace/TempProject"rn export MACOSX_DEPLOYMENT_TARGET=10.9rn /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -L/Users/Lawrence/Library/Developer/Xcode/DerivedData/TempProject-gsfqekbhfijequcmtomvccfjafol/Build/Products/Debug -F/Users/Lawrence/Library/Developer/Xcode/DerivedData/TempProject-gsfqekbhfijequcmtomvccfjafol/Build/Products/Debug -filelist /Users/Lawrence/Library/Developer/Xcode/DerivedData/TempProject-gsfqekbhfijequcmtomvccfjafol/Build/Intermediates/TempProject.build/Debug/TempProject.build/Objects-normal/x86_64/TempProject.LinkFileList -mmacosx-version-min=10.9 -stdlib=libc++ -Xlinker -dependency_info -Xlinker /Users/Lawrence/Library/Developer/Xcode/DerivedData/TempProject-gsfqekbhfijequcmtomvccfjafol/Build/Intermediates/TempProject.build/Debug/TempProject.build/Objects-normal/x86_64/TempProject_dependency_info.dat -o /Users/Lawrence/Library/Developer/Xcode/DerivedData/TempProject-gsfqekbhfijequcmtomvccfjafol/Build/Products/Debug/TempProjectrnrnUndefined symbols for architecture x86_64:rn "Config::source", referenced from:rn Config::getSource() in scan.orn "_lastTokenContent", referenced from:rn getWholeWord() in scan.orn getToken() in scan.orn "_sourceFile", referenced from:rn preScan() in scan.orn getNextChar() in scan.orn ungetCurrentChar() in scan.orn getWholeWord() in scan.ornld: symbol(s) not found for architecture x86_64rnclang: error: linker command failed with exit code 1 (use -v to see invocation)rnrnglobals.hrn[code=c]rn#ifndef GLOBALS_Hrn#define GLOBALS_Hrn#includernrnusing std::ifstream;rnrnenum TokenType rn ERROR,// error tokenrn REAL_NUMBER,// real numberrn;rnrnextern ifstream sourceFile;rnrn#endif // GLOBALS_Hrn[/code]rnrnscan.hrn[code=c]#ifndef SCANrn#define SCANrnrnTokenType getToken();rnrn#endif // SCANrn[/code]rnrnscan.cpprn[code=c]#include rn#include rn#include rn#include"globals.h"rn#include "scan.h"rn#include "Config.h"rnusing std::ifstream;rnusing std::cerr;rnusing std::endl;rnusing std::ios_base;rnusing std::ios;rnrnconst static int STATE_START = 0;rnrn/*rn * STATE_IN_ADDTION state means we get a char +,rn * we need read more char to judge we will get +=, ++ or just a single +rn * Other STATE_IN_XXX states are similar.rn */rnconst static int STATE_IN_IDENTIFIER= 17;rnconst static int STATE_IN_NUMBER = 18;rnconst static int STATE_END = -1;rnrnconst static int MAX_TOKEN_LENGTH = 64;rnextern ifstream sourceFile;rnrn/**rn * @brief lastTokenContent the token content in the last calling getToken();rn */rnextern char lastTokenContent[MAX_TOKEN_LENGTH+1];rnstatic int tokenContentPos = 0;rnrn/**rn * @brief preScan do some initial work before scanrn * this function will do:rn * 1. open the source file input streamrn */rnvoid preScan()rn if(!sourceFile.is_open())rn rn sourceFile.open(Config::getSource(),ios_base::in);rn if(!sourceFile.is_open())rn rn cerr<<"Open file "<

没有更多推荐了,返回首页

私密
私密原因:
请选择设置私密原因
  • 广告
  • 抄袭
  • 版权
  • 政治
  • 色情
  • 无意义
  • 其他
其他原因:
120
出错啦
系统繁忙,请稍后再试