ld: warning: ignoring file c, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x23 0x69 0x6E 0x63 0x6C 0x75 0x64 0x65 0x3C 0x69 0x6F 0x73 0x74 0x72 0x65 0x61 )
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
分析原因:在編譯時用了
g++ a
問題:a這個文件沒有擴展名
改正:將a重命名為a.cpp即可