Public Group

# xcode preprocessor macros

This topic is 680 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi

my sierra xcode preprocessor macros seem to get ignored. they always remain the same whatever I change.

many thanks

##### Share on other sites

You're welcome.

If you wanted something else than say thanks, it could be useful to state what you want as well, perhaps with a small example to demonstrate what you mean.

Saying "It fails" without further explanation hoa and what, is too abstract to say anything about, mostly.

Assuming you don't want to have the macros ignored, did you try generating the source after pre-processing (but before compiling)? Then you can see what the preprocessor actually does with the macros.

gcc uses the -E option for this, don't know what xcode uses.

Edited by Alberth

##### Share on other sites

Seems I need to try Eclipse on Mac again as Xcode is horrible. Apparently you have to change each setting in about 3 places.

Thanks

##### Share on other sites

Whilst you are starting out, perhaps keep things simple and just use clang from the command prompt.

\$ clang -o myprogram main.c


At this point it seems like you don't yet have much of an idea of what the IDE is actually doing behind the scenes when you click "Play" so it might be helpful. Remember do not be afraid of the command prompt otherwise you will miss out on a lot of great technology.

Also, I find Eclipse to be a little unfocused when it comes to the C/C++ programming pipeline. So perhaps one to try instead of Xcode would be Code::Blocks. That is pretty nice to start out with.

##### Share on other sites

Apparently you have to change each setting in about 3 places.

This is not, generally, true. What setting are you trying to change? Xcode (like Eclipse, like Visual Studio) has some bugs, flaws and annoyances. But defining preprocessor macros is purely to do with either the source code you've written or the set of -D flags you pass to the compiler. Which exist only in one location. Perhaps you are confusing this with the ability to change those settings per configuration, which is true of all IDEs that support build configurations?

##### Share on other sites

After some hours I found the target setting that I needed to modify. It was not at the same place anymore as in older xcode.

In Eclipse or VS you only have one setting for macros, but in xcode at least two: target and project

##### Share on other sites

Fascinating.

If you still want actual help with your preprocessor problem, you do have to give a simple (and preferably small) example of "not working", and explain how you concluded it fails to work. That is, what happens if you try that example, how is that different from what you expect, and why is that a problem.

Without further information, there are just too many things that might go wrong. We wouldn't even know where to start.

##### Share on other sites

I simply couldn't find the hidden target setting. Now all is fine. Sorry, xcode is way to complicated.

1. 1
2. 2
3. 3
Rutin
14
4. 4
5. 5

• 9
• 9
• 11
• 11
• 23
• ### Forum Statistics

• Total Topics
633674
• Total Posts
3013277
×