0

distilled.cpp

#include "distilled.hpp"

int main() {
    
}

distilled.hpp

#include "stdafx.h"

batch

cl distilled.cpp /Yustdafx.h /Fpstdafx.pch /I include /std:c++20 /EHsc -DDEBUGMODE=true /c

This is the ideal setup but generates compiler errors.

#include "stdafx.h"
#include "distilled.hpp"

int main() {

}

This works fine. When the stdafx is included in the cpp file, it compiles blazing fast, which is very cool, but ideally, I would want to put that inclusion in another file. This approach also creates include errors in nested files(only in VSCode, not an actual compilation), where the compiler only works if I have #include "stdafx.h" exactly, but IntelliSense wants #include "../stdafx.h". Am I doing something wrong to get this result?

Logos King
  • 121
  • 1
  • 6

0 Answers0