2011/7/27 PcX <xunxun1982@gmail.com>
于 2011/7/27 17:49, Ruben Van Boxem 写道:
2011/7/27 PcX <xunxun1982@gmail.com>
Hi, Ruben

   Your gcc-4.6.2's OpenMP (-fopenmp) seems to lack the linker option "-lpthread".

   I have to build OpenMP program using "gcc -fopenmp main.c -lgomp -lpthread" with your edition.

I believe that is a known limitation for MinGW's -fopenmp. Feel free to file a bug report with GCC. Is there another mingw-w64 toolchain you know that doesn't require this? fYI, I think -lgomp is implied by -fopenmp. It's just the -lpthread that you'd need to add manually.

Ruben
My gcc4.6.1 edition (MinGW64 CRT) don't need this : http://code.google.com/p/pcxprj/

You are right that "-lgomp is implied  by -fopenmp",  but the -lgomp linker option's position is wrong.
If I only use "-lpthread" and if you compiled the program using "gcc -v -fopenmp main.c -lpthread", you will find that "-lpthread" is before "-lgomp", so I must write "-lgomp -lpthread".

Is this problem also present with other toolchains by mingw.org and mingw-w64? If it is, this needs to be fixed upstream with GCC, otherwise I need to figure out what configure option I need to pass to GCC.

Ruben