Author Topic: problems compiling with openMP  (Read 13340 times)

Offline izzys

  • Single posting newcomer
  • *
  • Posts: 2
problems compiling with openMP
« 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

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: problems compiling with openMP
« Reply #1 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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: problems compiling with openMP
« Reply #2 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
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline izzys

  • Single posting newcomer
  • *
  • Posts: 2
Re: problems compiling with openMP
« Reply #3 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..

caihongzhu

  • Guest
Re: problems compiling with openMP
« Reply #4 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.