I am using #pragma once
in my .cpp
s and .hpp
s and because of that I get a warning for each file that uses it. I have not found any option to disable this kind of warning, only the thing of #ifndef MY_FILE_H #define MY_FILE_H /*...*/ #endif
.
So would you recommend me to replace each #pragma once
with ifndef
s?
in header:
#define MYFILE_H
// all the header
and in the other files:
#ifndef MYFILE_H
#include "myfile.hpp"
#endif
// the rest of the file
What do you think, is it better to use it like this? Or there is an option to disable the #pragma once
warnings in GCC, that I do not know?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…