Again "<omp.h> not found"...
-
Everyone good time of day!
I ask for help with solving a problem that does not allow me to work in principle.
I have to study OpenMP and change some programs with this standard, but whatever I do, I see nothing but "library not found".
I write flags in the .pro file:QMAKE_CXXFLAGS += -fopenmp QMAKE_LFLAGS += -fopenmp LIBS += -lgomp -lpthread
however, this does not change anything.
I tried MinGW 32bit and 64bit (7.3.0) - both do not see omp.h; using the online installer, I added MinGW 8.1.0 (64 bit), but there is the same error. On this website (https://docs-windows.readthedocs.io/en/latest/devel.html#mingw-with-openmp-support [EDIT: Link cleaned --JKSH]) I saw recommendations that I took advantage of. I set up a new compiler and debugger, and then a new build kit, but HE ALSO does not see omp.h, although he is there (in the gcc folder, however, and not in g++ - maybe you can't use OpenMP on C++?).
On Ubuntu 20.04 LTS, the same thing happens - "<omp.h> not found."
I really don't understand what's going on. I've been trying to do something for three days, so I'm incredibly counting on your help!
Thank you very much!
P.S. I use Qt 5.12.11 on Windows 10 64bit (now up to date). -
Everyone good time of day!
I ask for help with solving a problem that does not allow me to work in principle.
I have to study OpenMP and change some programs with this standard, but whatever I do, I see nothing but "library not found".
I write flags in the .pro file:QMAKE_CXXFLAGS += -fopenmp QMAKE_LFLAGS += -fopenmp LIBS += -lgomp -lpthread
however, this does not change anything.
I tried MinGW 32bit and 64bit (7.3.0) - both do not see omp.h; using the online installer, I added MinGW 8.1.0 (64 bit), but there is the same error. On this website (https://docs-windows.readthedocs.io/en/latest/devel.html#mingw-with-openmp-support [EDIT: Link cleaned --JKSH]) I saw recommendations that I took advantage of. I set up a new compiler and debugger, and then a new build kit, but HE ALSO does not see omp.h, although he is there (in the gcc folder, however, and not in g++ - maybe you can't use OpenMP on C++?).
On Ubuntu 20.04 LTS, the same thing happens - "<omp.h> not found."
I really don't understand what's going on. I've been trying to do something for three days, so I'm incredibly counting on your help!
Thank you very much!
P.S. I use Qt 5.12.11 on Windows 10 64bit (now up to date).Hi, and welcome!
@RoApPr said in Again "<omp.h> not found"...:
I saw recommendations that I took advantage of
Can you describe what recommendations you followed? Your link says, "Warning: The cython wiki Does not recommend using MinGW for the 64bit compiler"
<omp.h> not found
Where did you install omp.h? You must tell your compiler where to find it by adding INCLUDEPATH to your .pro file:
INCLUDEPATH += C:/path/to/openmp/
-
@JKSH said in Again "<omp.h> not found"...:
Can you describe what recommendations you followed?
Of course. By and large, I just installed TDM-GCC in a separate folder and created a new kit in Qt, indicating as a compiler and debugger everything that appeared in the newly created folder. Projects are normally compiled and launched, and only omp.h is not located, although it is there (and I included it in the installation).
@JKSH said in Again "<omp.h> not found"...:
Your link says, "Warning: ...
I did not understand this at all - perhaps here we are talking about cython and is not related to the applications C and C++.
@JKSH said in Again "<omp.h> not found"...:
Where did you install omp.h?
During TDM-GCC installation, I specified the folder:
C:\progs_central\compilers_set
@JKSH said in Again "<omp.h> not found"...:
You must tell your compiler where to find it by adding INCLUDEPATH to your .pro file
I included the path in the .pro file, and it really worked! Thank you very much!
Please tell me, is omp.h not included in the standard MinGW kit supplied with Qt, or did I just not find a way to it? Downloading third-party MinGW - the idea is strange (and I don't like it) - so I would like to find a path to omp.h in the standard Qt installation.
P.S. I apologize for my English - he is not my mother tongue :) -
@RoApPr said in Again "<omp.h> not found"...:
path to omp.h in the standard Qt installation.
Since Qt does not ship any omp headers or libraries I don't see what Qt should have to do with omp at all. If you want to include a header file you must tell the compiler where it can find it.
-
@Christian-Ehrlicher said in Again "<omp.h> not found"...:
I don't see what Qt should have to do with omp at all
... we might all think, but search for "omp" in the folder where you installed Qt - you will be very surprised. I find at least THREE "omp.h" files in three different directories inside the Qt folder.
This is where the original question comes from - if Qt creates directories with OpenMP (and if you start writing "#include <om", then "omp.h" will even be offered as an choice), then why don't compilers know where to get this library? Qt itself put these libraries here - so what's the problem? -
@Christian-Ehrlicher said in Again "<omp.h> not found"...:
I don't see what Qt should have to do with omp at all
... we might all think, but search for "omp" in the folder where you installed Qt - you will be very surprised. I find at least THREE "omp.h" files in three different directories inside the Qt folder.
This is where the original question comes from - if Qt creates directories with OpenMP (and if you start writing "#include <om", then "omp.h" will even be offered as an choice), then why don't compilers know where to get this library? Qt itself put these libraries here - so what's the problem?@RoApPr said in Again "<omp.h> not found"...:
search for "omp" in the folder where you installed Qt - you will be very surprised. I find at least THREE "omp.h" files in three different directories inside the Qt folder.
This is where the original question comes from - if Qt creates directories with OpenMP (and if you start writing "#include <om", then "omp.h" will even be offered as an choice), then why don't compilers know where to get this library? Qt itself put these libraries here - so what's the problem?Qt does not know anything about OpenMP. The Qt installer only provides a copy of MinGW.
It so happens that MinGW includes an "internal" copy of OpenMP. The compiler knows where to find the headers and libraries -- this code builds and runs just fine with Qt 5.14.1 + MinGW 7.3.0 (I don't need to install any extra 3rd-party software):
# openmptest.pro QT -= gui CONFIG += console SOURCES += main.cpp LIBS += -lgomp // main.cpp #include "omp.h" #include <QDebug> int main() { qDebug() << "Num threads:" << omp_get_num_threads(); }
You're probably wondering why you see the error message, "'omp.h' file not found" in your IDE. This error message does not come from the compiler. It comes from the static code analyser that is based on libclang. This code analyser does not know about the compiler's internal folders, so it didn't search those folders.
Again, notice that the code builds and runs, which means that the compiler can find them even if the code analyser can't find them. So, you can ignore the error message. (You can report this to https://bugreports.qt.io/ if you want it fixed)
-
@RoApPr said in Again "<omp.h> not found"...:
search for "omp" in the folder where you installed Qt - you will be very surprised. I find at least THREE "omp.h" files in three different directories inside the Qt folder.
This is where the original question comes from - if Qt creates directories with OpenMP (and if you start writing "#include <om", then "omp.h" will even be offered as an choice), then why don't compilers know where to get this library? Qt itself put these libraries here - so what's the problem?Qt does not know anything about OpenMP. The Qt installer only provides a copy of MinGW.
It so happens that MinGW includes an "internal" copy of OpenMP. The compiler knows where to find the headers and libraries -- this code builds and runs just fine with Qt 5.14.1 + MinGW 7.3.0 (I don't need to install any extra 3rd-party software):
# openmptest.pro QT -= gui CONFIG += console SOURCES += main.cpp LIBS += -lgomp // main.cpp #include "omp.h" #include <QDebug> int main() { qDebug() << "Num threads:" << omp_get_num_threads(); }
You're probably wondering why you see the error message, "'omp.h' file not found" in your IDE. This error message does not come from the compiler. It comes from the static code analyser that is based on libclang. This code analyser does not know about the compiler's internal folders, so it didn't search those folders.
Again, notice that the code builds and runs, which means that the compiler can find them even if the code analyser can't find them. So, you can ignore the error message. (You can report this to https://bugreports.qt.io/ if you want it fixed)
@JKSH said in Again "<omp.h> not found"...:
It comes from the static code analyser that is based on libclang.
Thank you very much for this information - I did not know this (I am programming on C++ not so long ago)!
@JKSH said in Again "<omp.h> not found"...:
Again, notice that the code builds and runs, which means that the compiler can find them even if the code analyser can't find them.
Yes, you are right - everything really works without directly indicating the directory.
Of course, I think I should direct the report to Qt, which I will do.
Thank you again!