User forums > Help

problems compiling with openMP

(1/1)

izzys:
hello,

I've read previous posts in this matter, and I've done all the necessary steps.

I've added "-fopenmp" to "Settings -> Compiler and debugger... -> Other options"
and "-lgomp -pthread" to "linker settings -> other linker options".

I still get the following message when I try to run the example code.

The program can't start because libgomp-1.dll is missing from your computer. Try
reinstalling the program to fix this program.

in the build log I get the following:

mingw32-g++.exe: unrecognized option '-pthread'
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings

I've seen in previous threads that another guy had a similar problem. he got a similar message to mine.
this was their reply:

The dll has to be in system path or in the exe's directory.

The easiest way is to add your MinGW's bin directory to the system-path.

how to I add my MinGW's bin directory to the system-path?

all the best

MortenMacFly:

--- Quote from: izzys on October 14, 2011, 05:11:22 am ---and "-lgomp -pthread" to "linker settings -> other linker options".

--- End quote ---
Do you mean:

--- Quote from: izzys on October 14, 2011, 05:11:22 am ---and "-lgomp -lpthread" to "linker settings -> other linker options".

--- End quote ---
probably???

And btw: this would basically mean to link against the two libraries: gomp and pthread, so you can set this directly in the linker libs, not other options.

Please try to make yourself familiar with the idea of a linker and the interface to a linker.

oBFusCATed:
Morten, "-pthread" is correct and it should be passed both to compiler and linker and it does more than just link to libpthread.

But I guess the problem is:
1. the compiler doesn't support openmp
2. the user should use -mthread or -mthread, but I've never tried to use openmp on windows, docs to the rescue

izzys:
Hello again, and thanks for the quick response.

I've made the change from "pthread" to "lpthread" and the message still appears.

however, the line that said - mingw32-g++.exe: unrecognized option '-pthread' - is now gone.

that's a progress..

caihongzhu:
Hello, I have the same problem. Here is the answer

Compiler Setting>Other Options>fopenmp ;

Link Setting>Other Options> -lgomp -lpthread ;

If it shows cannot find libgomp-1.dll, just copy that file to the current project folde(IT WORKS FOR ME)r. Here is the way that I do. Some people said that you can add the path for liggomp-1.dll to codeblocks. I tried that way but it still doesn't work. Please let me know if you find a way works by adding the path to the system.

Navigation

[0] Message Index

Go to full version