linux 静态库的链接 undefined reference

t+0x7): undefined reference to `test'   collect2: ld returned 1 exit status      这就是最典型的undefined reference错误,因为在链接时发现找不到某个函数的实现文件,本例中test.o文件中包含了test()函数的实现,所以如果按下面这种方式链接就没事了。 gcc -o main main.o test
相关文章
相关标签/搜索