Rex F
Rex F

Reputation: 85

XCode 4.4.1 - C++ - Apple Mach-O Linker (ID) Error - symbol (s) not found for architecture i386

I've written some simple C++ programs in XCode 4.4.1 Whenever I compile them, I get the following errors:

"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)

Is it making a reference to mainWrapper() in libStanfordCPPLib.a? The latter file is supplied and is it possible to modify the content? Else, do i need to make to a change to eliminate the reference to mainWrapper()? Thanks.

More details:

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)

Upvotes: 0

Views: 1014

Answers (1)

James
James

Reputation: 25513

It seems that whatever library you are using expects you to define a function called Main() (note the uppercase M), and you haven't done so.

Upvotes: 1

Related Questions