Itzik984
Itzik984

Reputation: 16764

Apple Mach-O Linker(id) Error

Im trying to compile a c++ project on xcode.

Im getting this error, and i really have no idea what to do.

searched similar problems , but none helped.

here is the error:

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)

any idea on what to do?

Upvotes: 0

Views: 677

Answers (1)

Some programmer dude
Some programmer dude

Reputation: 409136

All C and C++ code must have a global main function where execution starts. The main function must also, according to the specifications, return an integer and have none or two specific arguments:

int main()

int main(int, char **)

int main(int, char *[])

Upvotes: 2

Related Questions