作者henry8168 (番薯猴)
看板C_and_CPP
标题[问题] Undefined reference, symbol error问题
时间Tue Mar 22 14:15:23 2016
开发平台(Platform): (Ex: VC++, GCC, Linux, ...)
CentOS
额外使用到的函数库(Library Used): (Ex: OpenGL, ...)
#include "tbb/concurrent_hash_map.h"
#include "tbb/blocked_range.h"
#include "tbb/parallel_for.h"
问题(Question):
跑的程式码如下
https://gist.github.com/anonymous/d4da3b91772e7418163e
我已经将tbb做成symbol link到
/usr/include
/usr/lib
/usr/lib64
这三个目录下了,但执行
g++ hashtabletest.cpp -o hashtabletest
後会吐出一大片错误画面,如下:
http://i.stack.imgur.com/u44w5.png
这怎麽办才好?拜托大家救救我
喂入的资料(Input):
预期的正确结果(Expected Output):
错误结果(Wrong Output):
程式码(Code):(请善用置底文网页, 记得排版)
补充说明(Supplement):
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 36.236.76.109
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/C_and_CPP/M.1458627330.A.AF3.html
1F:→ shadow0326: 你要跟gcc讲要link谁呀 03/22 14:20
有例子吗?第一次碰到这问题 O_Q
※ 编辑: henry8168 (36.236.76.109), 03/22/2016 14:21:54
2F:→ shadow0326: 参数加-l <lib_path> 03/22 14:25
我加上lib的路径後,出现如下画面:
http://imgur.com/C3ppnVM.png
※ 编辑: henry8168 (36.236.76.109), 03/22/2016 14:38:53
3F:→ shadow0326: -l是接library档案,不是目录 03/22 14:54
library底下有好几个档案,我每个都尝试去link,但都出现差不多的讯息,
一样cannot find
http://imgur.com/md48HkG.png
拜托,能解决的话我愿意付200P
※ 编辑: henry8168 (36.236.76.109), 03/22/2016 15:02:35
4F:→ bibo9901: -L/path/to/lib/dir -ltbb 03/22 15:40
5F:→ bibo9901: 意思是去 /path/to/lib/dir 找 libtbb.so 03/22 15:40
原来如此,我成功让它找到library了!
但是又接着出现新的问题:
http://imgur.com/bmfMaMD.png
※ 编辑: henry8168 (36.236.76.109), 03/22/2016 15:51:25
最後让我自问自答,会出现我最後一张图的问题,
是因为我的程式码里没有main() function。
谢谢楼上两位,已发给两位各100P,记得确认^^
※ 编辑: henry8168 (36.236.76.109), 03/22/2016 16:33:47