mrmclovin
mrmclovin

Reputation: 1123

_DEBUG and LLVM 5.0 C++ : Preprocessor Expected value in expression

I'm having issues with XCode, LLVM and the _DEBUG definition. Or more specifically it seems to be something with underscore.

This is the second time I'm getting an error like this. This time Im compiling against PhysX lib.

/Library/Frameworks/PhysX.framework/Versions/3.2.1/include/foundation/PxPreprocessor.h:316:35: Expected value in expression

The line it's complaining about:

#if !defined(PX_CHECKED) && _DEBUG

And it points at right after the _DEBUG. If I remove the underscore it compiles fine (I did that on a similiar library last time as well, see http://www.ogre3d.org/forums/viewtopic.php?f=2&t=78990). But now Im feeling uneasy about this error. What is causing it and what does it mean?

Settings: Dialect: C++11, libc++ (Tried different ones, like GNUC++11 Max OSX 10.8 XCode 5 LLVM 5.0

Upvotes: 0

Views: 2037

Answers (1)

David Schwartz
David Schwartz

Reputation: 182827

Names that begin with an underscore are reserved for the implementation. Instead, use names that don't begin with an underscore unless you are specifically trying to access some implementation-specific feature.

Use defined() on implementation specific macros:

#if !defined(PX_CHECKED) && defined(_DEBUG)

If there's some reason you are expecting this to work, you haven't explained what it is. There is no reason this should work. What are you expecting it to do?

Upvotes: 4

Related Questions