// test.hpp
#include <iostream>
// test.cpp
#include "test.hpp"
int main(){std::cout << "hello world" << std::endl;}
Let's precompile header:
clang++ -c test.hpp
Let's use the header
clang++ test.cpp -H
Output shows it is not using the header, as no ! appears before test.hpp (like it does with g++):
. ./test.hpp
.. /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/iostream
... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/x86_64-linux-gnu/c++/9/bits/c++config.h
.... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/x86_64-linux-gnu/c++/9/bits/os_defines.h
..... /usr/include/features.h
Why is this?