User forums > Using Code::Blocks
OpenMP
biotech54:
sorry, i had a typo, i missed a semicolon, here is the build log.
-------------- Build: Debug in OpenMPTest (compiler: GNU GCC Compiler)---------------
mingw32-gcc.exe -Wall -g -c C:\MyHomeComputer\MyCppProjects\OpenMPTest\main.c -o obj\Debug\main.o
C:\MyHomeComputer\MyCppProjects\OpenMPTest\main.c: In function 'main':
C:\MyHomeComputer\MyCppProjects\OpenMPTest\main.c:10:0: warning: ignoring #pragma omp parallel [-Wunknown-pragmas]
#pragma omp parallel num_threads(threadCount)
^
C:\MyHomeComputer\MyCppProjects\OpenMPTest\main.c:9:8: warning: unused variable 'threadCount' [-Wunused-variable]
int threadCount = 4;
^
mingw32-g++.exe -o bin\Debug\OpenMPTest.exe obj\Debug\main.o
obj\Debug\main.o: In function `hello':
C:/MyHomeComputer/MyCppProjects/OpenMPTest/main.c:18: undefined reference to `omp_get_thread_num'
C:/MyHomeComputer/MyCppProjects/OpenMPTest/main.c:19: undefined reference to `omp_get_num_threads'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
3 error(s), 2 warning(s) (0 minute(s), 0 second(s))
stahta01:
link to the library gomp if I recall correctly.
Tim S.
BlueHazzard:
https://gcc.gnu.org/onlinedocs/libgomp/Enabling-OpenMP.html
You can add compiler commands in
Project->Build options->Select your project on the left side->Compiler settings->other compiler options
As stahta01 noted you probably will also need to link against a openmp library. You can google for it. The additional libraries can be added into
Project->Build options->Select your project on the left side->Linker settings->Link linraries
biotech54:
I checked both openmp website and gcc websites, unable to find the omp library, so I couldn't get the second step done
stahta01:
--- Quote from: biotech54 on September 25, 2017, 02:40:35 am ---I checked both openmp website and gcc websites, unable to find the omp library, so I couldn't get the second step done
--- End quote ---
Did you try linking to the gomp library before going on a search for the omp library?
Note: This is my last attempt to help you!
Tim S.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version