Using pragma once in a C++ project in Xcode 4

Posted by Nils on Stack Overflow See other posts from Stack Overflow or by Nils
Published on 2012-10-14T15:29:10Z Indexed on 2012/10/14 15:37 UTC
Read the original article Hit count: 149

Filed under:
|
|
|

I know that #pragma once is non-standard, however it is supported by most compilers. So on my Mac I can compile C++ code with headers that use #pragma once on the command line using clang++. The strange thing however is that it does not seem to work within Xcode. I get Invalid preprocessing directive when I try to use #pragma once.

I am using the newest version of OSX (10.8.2) and Xcode (Version 4.5.1 (4G1004)).

© Stack Overflow or respective owner

Related posts about c++

Related posts about xcode