user2693587
user2693587

Reputation:

#ifdef not working properly?

I am facing issues with Xcode 5.1. Everything works fine if I do this:

#include "glew.h"

But as soon as I try to make it cross-platform, it starts giving the compilation error.

#if defined(_APPLE_) || defined(_MACH_)
#define OS_MACOSX
#endif

#ifdef OS_MACOSX
#include "glew.h"
#else
#include <GL/glew.h>
#endif

Please help me to understand this.

Upvotes: 0

Views: 1290

Answers (2)

Mats Petersson
Mats Petersson

Reputation: 129314

You may want to use __APPLE__ instead of _APPLE_. That should solve it.

Oh, and don't moan at the IDE, it's got nothing to do with the IDE. It's about where Apple's developers decided to place the GL header files (and CL header files for that matter!)

Upvotes: 1

Michael Dautermann
Michael Dautermann

Reputation: 89509

Sounds like you simply need to add either a "GL" framework, or provide a proper "header search path" in your Xcode project.

Do you know the full path to the "<GL/glew.h>" file? If so, you can add the full path to your project settings.

Which you can do like this: Header Search Paths

Upvotes: 0

Related Questions