Search code examples
c++visual-studioqtc++17qt-creator

How to deal with pragma once?


To my understanding Visual Studio C++ projects use #pragma once in the very top of header files to prevent multiple inclusion.

And the same is achieved, in Qt Creator projects, with

#ifndef   FILE_H
#define   FILE_H
// Code here
#endif

Let's say I got a Visual Studio project and I want to play with Qt Creator. How to deal with the #pragma once issue?

If possible I don't want to edit all header files.


Solution

  • Yes, really, #pragma once originates from Microsoft C++, but nowadays it is supported by at least two another most used modern C++ compilers (i.e GCC and clang). So you should not have a problems with it.