LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 832|回复: 2

Common error message with "undefine reference to " of GCC

[复制链接]
发表于 2005-12-31 11:41:07 | 显示全部楼层 |阅读模式
Hi guys
   The following is common failure message of GCC,however, Because I tried other ways to resolved this in vain(e.g edit to Makefile-->LBFLAGS= -I/lib -I/usr/lib and so on)
[root@root tiny_SAX2]# make
g++  -g -O2  -L/lib -L/usr/lib -L/usr/local/lib -o main  main.o  -lpthread
main.o(.text+0x38): In function `main':
/usr/lib/qt-3.3/include/qstring.h:840: undefined reference to `QString::shared_n ull'
main.o(.text+0x41): In function `main':
/home/Test_QT/tiny_SAX2/main.cpp:14: undefined reference to `vtable for Structur eParser'
main.o(.text+0x48):/home/Test_QT/tiny_SAX2/main.cpp:14: undefined reference to ` vtable for StructureParser'
main.o(.text+0x4f):/home/Test_QT/tiny_SAX2/main.cpp:14: undefined reference to ` vtable for StructureParser'
(..........)
Thanks and cheers
发表于 2006-1-3 12:38:14 | 显示全部楼层
看样子是少链接了一些库
回复 支持 反对

使用道具 举报

发表于 2006-1-3 12:46:36 | 显示全部楼层
Normally, this kind of problems are due to missing libraries when linking
To solve, you need to add the result of `pkg-config --libs package_name` to gcc's command line option
Possibly, you also need to add the missing library's path to gcc's  library searching path using "-L" option

PS: I recommend a little book called "An introduction to gcc", it should be useful to you
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表