Code::Blocks Forums

User forums => Help => Topic started by: izzys on October 14, 2011, 05:11:22 am

Title: problems compiling with openMP
Post by: izzys on October 14, 2011, 05:11:22 am
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
Title: Re: problems compiling with openMP
Post by: MortenMacFly on October 14, 2011, 09:38:18 am
and "-lgomp -pthread" to "linker settings -> other linker options".
Do you mean:
and "-lgomp -lpthread" to "linker settings -> other linker options".
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.
Title: Re: problems compiling with openMP
Post by: oBFusCATed on October 14, 2011, 09:47:00 am
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
Title: Re: problems compiling with openMP
Post by: izzys on October 14, 2011, 10:17:51 am
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..
Title: Re: problems compiling with openMP
Post by: caihongzhu on April 06, 2013, 08:27:04 am
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.