Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-22225

"unexpected OpenMP directive" for included header file

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • None
    • Qt Creator 4.8.2, Qt Creator 4.9.0
    • C/C++/Obj-C++ Support
    • None
    • Linux/X11

    Description

      code model could not parse an include file with openmp directive

      /////
      code model message

      callomp.h:6:22: error: unexpected OpenMP directive '#pragma omp parallel for'
      main.cpp:1:1: note: in file included from /home/spise/work/qt/testcpp17/main.cpp:1:
      main.cpp:2:10: note: in file included from /home/spise/work/qt/testcpp17/main.cpp:2:

      // callomp.h

      
      #ifndef CALLOMP_H
       #define CALLOMP_H
      
      void callOmp(){
       #ifdef _OPENMP
       #pragma omp parallel for
       #endif
       for(int idx=0;idx<100;++idx){
       }
       }
      
      #endif // CALLOMP_H
      

      // main.cpp

      
      #include <vector>
       #include "callomp.h"
      
      int main()
      
      { return 0; }
      

      // test.pro:

      QT -= gui
      
      CONFIG += c++17 console
       CONFIG -= app_bundle
      
      QMAKE_LFLAGS += -fopenmp
       QMAKE_CXXFLAGS += -fopenmp
      
      DEFINES += QT_DEPRECATED_WARNINGS
      
      SOURCES += \
       main.cpp
      
      HEADERS += \
       callomp.h
      

      Attachments

        1. bth.zip
          2 kB
        2. image-2021-11-09-12-22-16-469.png
          image-2021-11-09-12-22-16-469.png
          60 kB
        3. image-2021-11-09-16-28-03-906.png
          image-2021-11-09-16-28-03-906.png
          88 kB
        4. image-2021-11-09-16-29-45-034.png
          image-2021-11-09-16-29-45-034.png
          88 kB
        5. qtcreator_omp_error.png
          qtcreator_omp_error.png
          181 kB
        6. screenshot-1.png
          screenshot-1.png
          21 kB
        7. screenshot-2.png
          screenshot-2.png
          74 kB

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              kandeler Christian Kandeler
              spise Andrew Sposobin
              Votes:
              8 Vote for this issue
              Watchers:
              13 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes