Does Qt support OpenMP?

后端 未结 4 1551
醉酒成梦
醉酒成梦 2021-02-08 23:31

I am using OpenMP in my Visual Studio projects and currently thinking very seriously in changing to QT creator. (Doesn\'t Visual Studio suck?,I expect much more from Microsoft)<

相关标签:
4条回答
  • 2021-02-09 00:11

    Does QT creator support OpenMP?

    As someone else mentioned, it's not Qt itself that support OpenMP but the compiler.

    What should I do to enable it?

    If you have installed a recent Qt 4.6.x SDK (hint: latest QtCreator 1.3 is included), it comes with MinGW 4.4 which has OpenMP support built-in.

    Do I need to do something special?

    Edit your project .pro file and add the following lines to pass the OpenMP flags to the compiler :

    QMAKE_CXXFLAGS += -fopenmp
    LIBS += -fopenmp
    

    Enjoy!

    0 讨论(0)
  • 2021-02-09 00:12

    In addition to esavard's answer, I found that I needed to add:

    LIBS += -fopenmp

    for the program to link properly. I'm running QT creator 2.0.1 with QT 4.7.0 on Ubuntu 10.10 (64 bit). Hope this helps anyone else running into the "undefined reference to 'GOMP_parallel_start'" type errors.

    0 讨论(0)
  • 2021-02-09 00:30

    add two line for both compile and link QMAKE_CXXFLAGS += -fopenmp QMAKE_LFLAGS += -fopenmp

    0 讨论(0)
  • 2021-02-09 00:36

    Qt itself has no own C++ compiler, instead it uses existing, for example on Windows platform it is mingw. Officially migw supports OpenMP since 4.2.0

    0 讨论(0)
提交回复
热议问题