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即可