0

我在 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()inlibStanfordCPPLib.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)
4

1 回答 1

1

似乎您使用的任何库都希望您定义一个名为Main()(注意大写 M)的函数,而您还没有这样做。

于 2012-09-01T12:06:52.240 回答