I am using pragma once
in my .cpp
files.
However I am always having a warning #pragma once in main file
.
How to disable it? I am using GCC 5.1.0
.
I am using pragma once
in my .cpp
files.
However I am always having a warning #pragma once in main file
.
How to disable it? I am using GCC 5.1.0
.
I am not sure there is a way.
Putting #pragma once
in the main file isn't actually useful. #pragma once
it used in a header to prevent the header from being included more than once.
Note that #pragma once
is unavoidably slower than using the straightforward and portable header guard style:
#ifndef something_h
#define something_h
... header text here
#endif
So I would recommend simply not using it ever.
Use the -w
compile option to remove this warning.
e.g. gcc -w -o <output file> <input file(s)>