添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Author Topic: [SOLVED]Build fails due to preprocessor macro in "TargetConditionals.h" file  (Read 4397 times)

0 Members and 1 Guest are viewing this topic.

May I first thank each and every member of the SFML Team and anyone who has contributed to the SFML project for you work. I LOVE SFML so much! :D It gives what may I call "simplistic control," the best kind. ;)

Now for some context:
I am working on a Pong extension named Pong++. I have set up a game engine/game state manager, and have coded a splash screen. But, when I build I am greeted by this error complaining about the
#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
line of "Config.hpp" file(line 54 to be exact). Here is the full error:

/usr/local/include/SFML/Config.hpp:54:9: error: invalid token at start of a preprocessor expression
#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
^

I am on MacOS(OS X as it was called at the time of release)version 1.9 (Mavericks), and have SFML 2.5.1 installed. I have not tried reinstalling SFML, but it seems to be an issue with my version of SFML, so if I do I will install the latest commit.

(I did try this in a file just importing the "Config.h" file by itself in a single file and still got an error.)
According to the documentation inside that header, and various examples found for example on stackoverflow, the original code was right. These macros are always defined, it's their value that must be tested.

Quote
TARGET_OS_*
These conditionals specify in which Operating System the generated code will
run. At most one of the these is true, the rest are false.
Re: [SOLVED]Build fails due to preprocessor macro in "TargetConditionals.h" file
« Reply #4 on: January 22, 2019, 08:23:52 am »
All the versions of that file that I could find, always define all these macros (unconditionally).

Mr.Zeus, maybe you should investigate what happens in your specific environment, since you're the only one who gets this error. You can post the content of your TargetConditional.h header for example, or post a preprocessed version of Config.hpp.
Quote
Now I don't quite know what you mean by "preprocessed version of Config.hpp."
You can invoke the compiler on a source file, with specific flags, so that it outputs the preprocesses version of that file, ie. with only the preprocessor pass done (not compiled). The goal is to know how the preprocessor replaces those macros in Config.hpp.
The preprocessor passed "Config.hpp" file:

(click to show/hide)

Hope it helps!