OpenMP libgomp_64-1.dll is missing

2013-06-30
2013-09-17
  • Stefan Knauf

    Stefan Knauf - 2013-06-30

    Hi all!

    I tried to use Dev-C++ 5.4.2 (with TDM-GCC 4.7.1 64-bit Release) for the following code (it is from page 2 of http://www.bero-software.de/tutorials_programming/omp.pdf):

    #include <stdio.h>
    #include <omp.h>
    
    int main(int argc, char* argv[])
    {
    #pragma omp parallel
    {
    printf("I am thread %d of %d.\n", omp_get_thread_num()+1, omp_get_num_threads());
    }
    return 0;
    }
    

    The compiler does not grump. But when I try to run the program I get an error message telling me that I cannot run the program because libgomp_64-1.dll is missing. Reinstalling Dev-C++ does not solve the problem. My operating system is the 64 bit version of Windows 7. And I do use the '-fopenmp' command when calling the compiler.
    When I try to run a program that does not use OpenMP, it works. How can I run a program using OpenMP?

    Thanks in advance!

    Stefan Knauf

     
    • Herbert Paulis

      Herbert Paulis - 2013-08-23

      Hi Stefan,

      actually all the openmp libraries are present with TDM-GC 64-bit (which funnily works only in a directory named "MinGW64", some kind of bug?, at least with my installation. Try calling "cpp --help" in a console window, then the compiler declares itself). I use openmp successfully for quite some time now. The trick is that you have to instruct the linker specifically to use the library for linking, they are not searched for automatically.

      At "Project Options --> Parameter" add the path and library name in the "Linker" field, e.g. "../../MinGW64/lib/gcc/x86_64-w64-mingw32/4.7.1/libgomp.dll.a" or whatever openmp lib you need. Your path may be different, depending on your install. Just do a search in your compiler dirs, looking for "libgomp*.*" to find out where they rest on your machine.

      regards
      Herbert

      PS: A tipp for your example code: use the "critical" specifier in the omp pragma or you will have a funny surprise on the output (hint: parallelization goes very deep)
      ;)

       
      • Stefan Knauf

        Stefan Knauf - 2013-09-17

        Hi Herbert!

        Thanks for explanation! I tried your solution, but it didn't work. But I got another idea. I copied the files Dev-Cpp\MinGW64\bin\libgomp_64-1.dll and Dev-Cpp\MinGW64\bin\libgomp_64-1.dll\pthreadGC2_64.dll into the folder in which my program runs. Then it seems to work! The output of the example code is:

        I amI am thread 1 of t2.
        hread 2 of 2.

        If this is the funny surprise that you mentioned, I will think everything works fine. Tomorrow I will try some other example code.

        regards
        Stefan

         

Log in to post a comment.