我试图在xcode上编译一个c ++项目。
我得到了这个错误,我真的不知道该怎么做。
搜索了类似的问题,但都没有帮助。
这是错误:
Ld /Users/itzikhanoch/Library/Developer/Xcode/DerivedData/ex4-eepdugqcjenwebctvbtmtbkyguxu/Build/Products/Debug/ex4 normal x86_64
cd /Users/itzikhanoch/Documents/XcodeWorkspace/ex4
setenv MACOSX_DEPLOYMENT_TARGET 10.7
/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.7.sdk -L/Users/itzikhanoch/Library/Developer/Xcode/DerivedData/ex4-eepdugqcjenwebctvbtmtbkyguxu/Build/Products/Debug -F/Users/itzikhanoch/Library/Developer/Xcode/DerivedData/ex4-eepdugqcjenwebctvbtmtbkyguxu/Build/Products/Debug -filelist /Users/itzikhanoch/Library/Developer/Xcode/DerivedData/ex4-eepdugqcjenwebctvbtmtbkyguxu/Build/Intermediates/ex4.build/Debug/ex4.build/Objects-normal/x86_64/ex4.LinkFileList -mmacosx-version-min=10.7 -o /Users/itzikhanoch/Library/Developer/Xcode/DerivedData/ex4-eepdugqcjenwebctvbtmtbkyguxu/Build/Products/Debug/ex4
Undefined symbols for architecture x86_64:
"_main", referenced from:
start in crt1.10.6.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
关于该做什么的任何想法?
答案 0 :(得分:2)
所有C和C ++代码必须具有执行开始的全局main
函数。根据规范,main
函数还必须返回一个整数,并且没有或两个特定的参数:
int main()
int main(int, char **)
int main(int, char *[])