openMP and ImageMagick

Hello there,

I am writing a code which includes imagemagick and openmp. when i compile the code with all needed flags, including <omp.h> & <Magick++.h> it fails and tells me:

test.cpp:78: error: ‘omp_get_thread_num’ was not declared in this scope
test.cpp:82: error: ‘omp_get_num_threads’ was not declared in this scope

. if i remove <Magick++.h> , still compiling with Magick related compiler flags, it compiles and run beautifully.

here is the compile command:

g++ test.cpp -fopenmp -D_FORTIFY_SOURCE=2 -I/usr/include/ImageMagick -L/usr/lib -O2 -W -Wall -fasynchronous-unwind-tables -fmessage-length=0 -fopenmp -fstack-protector -fstack-protector-all -funwind-tables -g -lMagick++ -lMagickCore -lMagickWand -lfreetype -lz -march=i586 -mtune=i686

what should i do?!

i am on openSUSE 11.1, gcc 4.3.2. doing in c plus plus.

Thank you

-L/usr/lib

Neverpass a library path to the compiler where it will search by default. But this has nothing to do with your problem.

Try exchanging the include order, i.e. omp.h before magick.h (or the other way round).

Otherwise you’ll have to see if the imagemagick header defines stuff that switches off omp.h.

Philipp

Thank you philipp, u were right. changing the order of #include s made it work. <omp.h> must be before <Magick++.h>