How to solve the issue with the situation given in the topic?

I have a project on a C ++ structure that looks like this:

../parse/ ../../export.cpp ../../import.cpp ../../и др. файлы ../precomp.hpp ../precomp.cpp 

In the current situation, I get a completely logical error:

\ parse \ export.cpp (1): warning C4627: '#include "../precomp.hpp' ': skipped when looking for precompiled header use Add directive to' precomp.hpp 'or rebuild precompiled header

I would like to avoid the situation with the transfer of files from the parse/ folder to a level above where the precomp.hpp file is precomp.hpp , but otherwise I don’t see a way.

So is there a way to compile a project with the current structure with precomp.hpp headers, when the precomp.hpp file precomp.hpp in one and the export.cpp in another?

  • And how should the compiler find this file if the file is a higher level? - sys_dev
  • Transform a comment into an answer and I will mark it as a solution. I do not know why, but it helped! And I don’t know how it will be in Linux, but this is a topic for another brainwashing :) - sys_dev

1 answer 1

In the \parse\export.cpp file, include without specifying the path:

 #include "precomp.hpp" 

It does not matter that the path does not exist, the main thing is that the precomp.hpp spelling precomp.hpp the one specified in the Precompiled Header File configuration of the project / file.