Phantom
Phantom

Reputation: 875

OpenMP omp_get_wtime g++ 32bits

For measuring the time of some parts of a program I want to use the omp_get_wtime() function from OpenMP. I can compile the project only in 32bits (with the -m32 gcc option). And I get those errors:

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'

While I don't have any error when I compile in 64bits (I made a simple test).

I use -fopenmp to link openmp. I tried to add -gomp, but it didn't change anything.

I'm running under a 2012 Cent OS release (64bits), and compiling with gcc 4.4.7.
And to make it more funny, I can't upgrade or install anything with apt, but I can compile from sources some missing libraries.

Upvotes: 1

Views: 262

Answers (1)

Florian Weimer
Florian Weimer

Reputation: 33719

Older versions of glibc define clock_getres and clock_gettime in librt, not libc, so you probably just need to link with -lrt.

Upvotes: 2

Related Questions