当前时区为 UTC + 8 小时



发表新帖 回复这个主题  [ 4 篇帖子 ] 
作者 内容
1 楼 
 文章标题 : 请教帮我弄懂这段make之后的代码
帖子发表于 : 2010-11-21 9:41 

注册: 2009-07-21 22:35
帖子: 14
送出感谢: 0 次
接收感谢: 0 次
我安装这个库的时候木有问题,它自己测试了一个bench.cpp程序,编译出的bench文
件运行也木有问题
之后,我自己用它编译一个cpp的程序,就会报错了(包括bench.cpp,我试过)
想请教一下怎么解决
或者请哪位能够告诉我它在编译bench.cpp的时候都做了那些事情呢,谢谢
如下为库编译好之后测试bench.cpp的代码:
make[2]: Entering directory `/home/eecs/Desktop/meepinstall/meep-0.10/tests'
if g++ -DHAVE_CONFIG_H -I. -I. -I.. -I../src -O2 -malign-double -march=pen
tium4 -MT bench.o -MD -MP -MF ".deps/bench.Tpo" -c -o bench.o bench.cpp; \
then mv -f ".deps/bench.Tpo" ".deps/bench.Po"; else rm -f ".deps/bench.Tpo";
exit 1; fi
/bin/bash ../libtool --tag=CXX --mode=link g++ -O2 -malign-double -march=pen
tium4 -o bench bench.o ../src/libmeep.la -lhdf5 -lz -lharminv -llapack -lb
las -lm -L/usr/lib/gcc/i686-linux-gnu/4.4.5 -L/usr/lib/gcc/i686-linux-gnu/4
.4.5/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/i686-linu
x-gnu/4.4.5/../../.. -L/usr/lib/i686-linux-gnu -lgfortranbegin -lgfortran -lm
-lgcc_s
g++ -O2 -malign-double -march=pentium4 -o bench bench.o ../src/.libs/libmeep
.a /usr/lib/libhdf5.so -lpthread -lz -lharminv -llapack -lblas -L/usr/lib/gcc
/i686-linux-gnu/4.4.5 -L/usr/lib/gcc/i686-linux-gnu/4.4.5/../../../../lib -L/
lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/i686-linux-gnu/4.4.5/../../.. -L/
usr/lib/i686-linux-gnu -lgfortranbegin -lgfortran -lm -lgcc_s
make[2]: Leaving directory `/home/eecs/Desktop/meepinstall/meep-0.10/tests'

如下为我编译一个cpp程序时报错:
eecs@ubuntu:~/Desktop/meepinstall/meep-0.10/tests$ g++ flux.cpp $(pkg-config
--cflags --libs meep)
/usr/local/lib/libblas.a(xerbla.o): In function `xerbla_':
(.text+0x0): multiple definition of `xerbla_'
/usr/local/lib/liblapack.a(xerbla.o):(.text+0x0): first defined here
/usr/local/lib/libhdf5.a(H5.o): In function `H5dont_atexit':
(.text+0xfdc): undefined reference to `pthread_once'
/usr/local/lib/libhdf5.a(H5.o): In function `H5check_version':
(.text+0x1049): undefined reference to `pthread_once'
/usr/local/lib/libhdf5.a(H5.o): In function `H5_term_library':
(.text+0x132c): undefined reference to `pthread_once'
/usr/local/lib/libhdf5.a(H5.o): In function `H5close':
(.text+0x1d58): undefined reference to `pthread_once'
/usr/local/lib/libhdf5.a(H5.o): In function `H5open':
(.text+0x231b): undefined reference to `pthread_once'
/usr/local/lib/libhdf5.a(H5.o):(.text+0x23db): more undefined references to `
pthread_once' follow
/usr/local/lib/libhdf5.a(H5E.o): In function `H5E_push':
(.text+0x268): undefined reference to `pthread_getspecific'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5E_push':
(.text+0x2a8): undefined reference to `pthread_setspecific'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5E_dump_api_stack':
(.text+0x351): undefined reference to `pthread_getspecific'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5E_dump_api_stack':
(.text+0x391): undefined reference to `pthread_setspecific'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5E_clear':
(.text+0x3c1): undefined reference to `pthread_getspecific'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5E_clear':
(.text+0x401): undefined reference to `pthread_setspecific'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5Eget_auto':
(.text+0x453): undefined reference to `pthread_once'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5Eget_auto':
(.text+0x495): undefined reference to `pthread_getspecific'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5Eget_auto':
(.text+0x4d5): undefined reference to `pthread_setspecific'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5Eget_auto':
(.text+0x566): undefined reference to `pthread_getspecific'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5Eget_auto':
(.text+0x5a6): undefined reference to `pthread_setspecific'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5Eget_auto':
(.text+0x5bb): undefined reference to `pthread_getspecific'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5Eget_auto':
(.text+0x5fb): undefined reference to `pthread_setspecific'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5Eset_auto':
(.text+0x6c1): undefined reference to `pthread_once'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5Eset_auto':
(.text+0x703): undefined reference to `pthread_getspecific'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5Eset_auto':
(.text+0x743): undefined reference to `pthread_setspecific'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5Eset_auto':
(.text+0x7d4): undefined reference to `pthread_getspecific'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5Eset_auto':
(.text+0x814): undefined reference to `pthread_setspecific'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5Eset_auto':
(.text+0x829): undefined reference to `pthread_getspecific'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5Eset_auto':
(.text+0x869): undefined reference to `pthread_setspecific'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5E_walk':
(.text+0x91d): undefined reference to `pthread_getspecific'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5E_walk':
(.text+0x95d): undefined reference to `pthread_setspecific'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5Eclear':
(.text+0xa03): undefined reference to `pthread_once'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5Eclear':
(.text+0xa45): undefined reference to `pthread_getspecific'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5Eclear':
(.text+0xa85): undefined reference to `pthread_setspecific'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5Epush':
(.text+0xb52): undefined reference to `pthread_once'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5Epush':
(.text+0xb94): undefined reference to `pthread_getspecific'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5Epush':
(.text+0xbd4): undefined reference to `pthread_setspecific'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5Epush':
(.text+0xc65): undefined reference to `pthread_getspecific'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5Epush':
(.text+0xca5): undefined reference to `pthread_setspecific'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5Eprint':
(.text+0xd5b): undefined reference to `pthread_getspecific'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5Eprint':
(.text+0xd9b): undefined reference to `pthread_setspecific'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5Eprint':
(.text+0xdaf): undefined reference to `pthread_once'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5Eprint':
(.text+0xdf1): undefined reference to `pthread_getspecific'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5Eprint':
(.text+0xe31): undefined reference to `pthread_setspecific'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5Ewalk':
(.text+0xf68): undefined reference to `pthread_once'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5Ewalk':
(.text+0xfaa): undefined reference to `pthread_getspecific'
/usr/local/lib/libhdf5.a(H5E.o): In function `H5Ewalk':
(.text+0xfea): undefined reference to `pthread_setspecific'
/usr/local/lib/libhdf5.a(H5F.o): In function `H5Fget_name':
(.text+0x1824): undefined reference to `pthread_once'
/usr/local/lib/libhdf5.a(H5F.o): In function `H5Fget_filesize':
(.text+0x1ac7): undefined reference to `pthread_once'
/usr/local/lib/libhdf5.a(H5F.o): In function `H5Fget_freespace':
(.text+0x1cb0): undefined reference to `pthread_once'
/usr/local/lib/libhdf5.a(H5F.o): In function `H5Fget_create_plist':
(.text+0x23b2): undefined reference to `pthread_once'
/usr/local/lib/libhdf5.a(H5F.o): In function `H5Fclose':
(.text+0x2eeb): undefined reference to `pthread_once'
/usr/local/lib/libhdf5.a(H5F.o):(.text+0x348e): more undefined references to
`pthread_once' follow
/usr/local/lib/libhdf5.a(H5TS.o): In function `H5TS_cancel_count_dec':
(.text+0xd): undefined reference to `pthread_getspecific'
/usr/local/lib/libhdf5.a(H5TS.o): In function `H5TS_cancel_count_inc':
(.text+0x46): undefined reference to `pthread_getspecific'
/usr/local/lib/libhdf5.a(H5TS.o): In function `H5TS_cancel_count_inc':
(.text+0xb7): undefined reference to `pthread_setspecific'
/usr/local/lib/libhdf5.a(H5TS.o): In function `H5TS_first_thread_init':
(.text+0x24d): undefined reference to `pthread_key_create'
/usr/local/lib/libhdf5.a(H5TS.o): In function `H5TS_first_thread_init':
(.text+0x261): undefined reference to `pthread_key_create'
/usr/local/lib/libhdf5.a(H5TS.o): In function `H5TS_first_thread_init':
(.text+0x275): undefined reference to `pthread_key_create'
/usr/local/lib/libhdf5.a(H5Z.o): In function `H5Zget_filter_info':
(.text+0x837): undefined reference to `pthread_once'
/usr/local/lib/libhdf5.a(H5Z.o): In function `H5Zfilter_avail':
(.text+0x986): undefined reference to `pthread_once'
/usr/local/lib/libhdf5.a(H5Z.o): In function `H5Zregister':
(.text+0xb38): undefined reference to `pthread_once'
/usr/local/lib/libhdf5.a(H5Z.o): In function `H5Zunregister':
(.text+0x1b17): undefined reference to `pthread_once'
collect2: ld returned 1 exit status


页首
 用户资料  
 
2 楼 
 文章标题 : Re: 请教帮我弄懂这段make之后的代码
帖子发表于 : 2010-11-21 16:59 

注册: 2008-01-25 23:12
帖子: 3
送出感谢: 0 次
接收感谢: 0 次
编译选项加上-lpthread


页首
 用户资料  
 
3 楼 
 文章标题 : Re: 请教帮我弄懂这段make之后的代码
帖子发表于 : 2010-11-22 8:59 

注册: 2009-07-21 22:35
帖子: 14
送出感谢: 0 次
接收感谢: 0 次
谢谢,问题已解决


页首
 用户资料  
 
4 楼 
 文章标题 : Re: 请教帮我弄懂这段make之后的代码
帖子发表于 : 2010-12-14 13:45 
头像

注册: 2008-09-03 16:16
帖子: 47
地址: 江湖
送出感谢: 3
接收感谢: 0 次
:em11 涉及到线程知识的gcc后面得加 -lpthread


页首
 用户资料  
 
显示帖子 :  排序  
发表新帖 回复这个主题  [ 4 篇帖子 ] 

当前时区为 UTC + 8 小时


在线用户

正在浏览此版面的用户:没有注册用户 和 3 位游客


不能 在这个版面发表主题
不能 在这个版面回复主题
不能 在这个版面编辑帖子
不能 在这个版面删除帖子
不能 在这个版面提交附件

前往 :  
本站点为公益性站点,用于推广开源自由软件,由 DiaHosting VPSBudgetVM VPS 提供服务。
我们认为:软件应可免费取得,软件工具在各种语言环境下皆可使用,且不会有任何功能上的差异;
人们应有定制和修改软件的自由,且方式不受限制,只要他们自认为合适。

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
简体中文语系由 王笑宇 翻译