当前位置: 技术问答>linux和unix
连接两个.o文件报错,麻烦帮看下,unix平台
来源: 互联网 发布时间:2016-11-02
本文导语: gcc -o filesymbol.o ourhdr.o ld: 0711-317 ERROR: Undefined symbol: .main ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. collect2: ld returned 8 exit status | 这不是链接两个.o文件,而是链接一个o...
gcc -o filesymbol.o ourhdr.o
ld: 0711-317 ERROR: Undefined symbol: .main
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
collect2: ld returned 8 exit status
ld: 0711-317 ERROR: Undefined symbol: .main
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
collect2: ld returned 8 exit status
|
这不是链接两个.o文件,而是链接一个ourhdr.o,结果生成filesymbol.o
应该这么写:gcc filesymbol.o ourhdr.o (结果生成a.out)
或者 gcc -o outputfile filesymbol.o ourhdr.o (结果生成outputfile)