Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/126.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apple Mach-O链接器(id)错误 我试图在XCOD.< /P>上编译一个C++项目_C++_Xcode_Macos - Fatal编程技术网

Apple Mach-O链接器(id)错误 我试图在XCOD.< /P>上编译一个C++项目

Apple Mach-O链接器(id)错误 我试图在XCOD.< /P>上编译一个C++项目,c++,xcode,macos,C++,Xcode,Macos,我犯了这个错误,我真的不知道该怎么办 搜索了类似的问题,但没有任何帮助 以下是错误: 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_T

我犯了这个错误,我真的不知道该怎么办

搜索了类似的问题,但没有任何帮助

以下是错误:

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)

<> P>所有的C++和C++代码都必须有一个全局的<代码>主< /代码>函数,在那里执行开始。根据规范,
main
函数还必须返回一个整数,并且没有或有两个特定参数:

int main()

int main(int, char **)

int main(int, char *[])

您确实有一个全局
main
函数吗?如果您正在构建应用程序,则需要一个main,但如果您正在构建库,则不需要。