我在XCode 4.4.1中编写了一些简单的C ++程序。每当我编译它们时,我都会遇到以下错误:
"Main()", referenced from:
mainWrapper() in libStanfordCPPLib.a(startup.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
是否在mainWrapper()
中引用了libStanfordCPPLib.a
?提供后一个文件,是否可以修改内容?否则,我是否需要进行更改以消除对mainWrapper()
的引用?感谢。
更多详情:
Ld ./BlankProject.app/Contents/MacOS/BlankProject normal i386
cd "/Users/benjamin/Documents/Programming/iTunes U/Stanford/CS106B Programming Abstractions/Summer 2012/Programs/Section Handout #2 Question 2"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch i386 "-L/Users/benjamin/Documents/Programming/iTunes U/Stanford/CS106B Programming Abstractions/Summer 2012/Programs/Section Handout #2 Question 2" -LStanfordCPPLib "-L/Users/benjamin/Documents/Programming/iTunes U/Stanford/CS106B Programming Abstractions/Summer 2012/Programs/Section Handout #2 Question 2/StanfordCPPLib" "-F/Users/benjamin/Documents/Programming/iTunes U/Stanford/CS106B Programming Abstractions/Summer 2012/Programs/Section Handout #2 Question 2" -filelist "/Users/benjamin/Library/Developer/Xcode/DerivedData/BlankProject-fxnhpjsyinnahlexvnlrhbilvwkd/Build/Intermediates/BlankProject.build/Debug/Section Handout #2 Question 4a.build/Objects-normal/i386/BlankProject.LinkFileList" -framework Cocoa -framework Carbon -framework QuickTime -lStanfordCPPLib -o "/Users/benjamin/Documents/Programming/iTunes U/Stanford/CS106B Programming Abstractions/Summer 2012/Programs/Section Handout #2 Question 2/./BlankProject.app/Contents/MacOS/BlankProject"
Undefined symbols for architecture i386:
"Main()", referenced from:
mainWrapper() in libStanfordCPPLib.a(startup.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
答案 0 :(得分:1)
似乎您使用的任何库都希望您定义一个名为Main()
的函数(注意大写的M),但您还没有这样做。