为了测量程序某些部分的时间,我想使用OpenMP中的omp_get_wtime()
函数。我只能用32位编译项目(使用-m32
gcc选项)。我得到了那些错误:
libgomp.a(time.o): In function 'gomp_ialias_omp_get_wtick':
undefined reference to 'clock_getres'
libgomp.a(time.o): In function 'gomp_ialias_omp_get_wtime':
undefined reference to 'clock_gettime'
虽然我在64位编译时没有任何错误(我做了一个简单的测试)。
我使用-fopenmp
链接openmp
。我尝试添加-gomp
,但它没有改变任何内容。
我在2012 Cent OS版本(64位)下运行,并使用gcc 4.4.7进行编译
为了使它更有趣,我无法使用apt
升级或安装任何内容,但我可以从一些缺少库的源代码编译。
答案 0 :(得分:2)
旧版本的glibc在clock_getres
中定义clock_gettime
和librt
,而不是libc
,因此您可能只需要与-lrt
进行关联。