Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
File not found error for unincluded headers
I have a c++ driver header file which have the lines
When I try to compile this on Windows, it fails to compile and gives file not found error for the i2c.h and i2c-dev.h. But they are not supposed to be included at all since the #ifndef statement should have excluded them. I do not get what is causing this error.
Did you include QtGlobal header file where you're using Q_OS_WIN?
Beside the good point made by @jsulm, to avoid such a case, you should rather use
as there are other OSs that Qt supports that will not have these includes.
Thanks for the replies, I included QtGlobal, but it is still giving me the same file not found compilation error.
I found solution. The header file was not included in the HEADERS of .pro file. I just add it to the HEADERS and the compilation error disappeared.