I created a header file. Something simple as follows.
#pragma once
#include <iostream>
template<typename T>
void say(T t) {
std::cout << t << std::endl;
}
and then use g++
to create the gch
pre-compiled header with g++ hello.h
. It gives me this warning ->
pch.h:2:9: warning: #pragma once in main file
2 | #pragma once
| ^~~~
But the gch
file created and the pre-compiled header works fine. This error goes away if I use header guards.
Am I doing something wrong here?