When compiling this simple program: (with clang++-11 -fmodules main.cpp -o main.o -std=c++2a
)
// main.cpp
import "pch1.h";
int main() {
std::cout << "Hello" << std::endl;
}
I get the following error message:
main.cpp:3:8: error: header file "pch1.h" (aka './pch1.h') cannot be imported because it is not known to be a header unit
Obviously I need to do something with the header file before using it, but what flags does clang expect?
The question is twofold:
- What flags do clang want to compile/precompile the header unit
- What flags do clang want to feed the header unit into main.cpp