Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: scarphin on April 14, 2011, 11:23:34 am
-
Is there any constants defined when a specific build target is chosen? I mean does CB define anything automatically? I'm trying to compile build target specific code like below:
#if defined DEBUG (can be something CB defines)
do this;
#elif defined RELEASE (same here)
do that;
I know I can define them manually but I want to use what CB defines if there is any. Thnx...
-
Inside C::B the "$target"-variable contains the name of the active build-target.
-
I couldn't think of a way to use it, I guess it won't work when injected into the source like '$target'. So how can I make a constant out of it?
-
I know I can define them manually but I want to use what CB defines if there is any. Thnx...
There are no automatic/automagic defines, you have to add all you defines in project -> build options -> [target] -> compiler -> defines
-
I know I can define them manually but I want to use what CB defines if there is any. Thnx...
There are no automatic/automagic defines, you have to add all you defines in project -> build options -> [target] -> compiler -> defines
Well, I'm not looking for magic, that was what I was looking for. ;) One last question, I've searched but couldn't find and specific information about this. How do I define a constant in project -> build options -> [target] -> compiler -> defines?
Is it like
'#define DEBUG 1'
or just
'DEBUG 1'
or how?
-
either you just define it, aka value doesn't matter :
or you give it a value
-
Ok got it. Maybe because I'm a noob but the work u have done with codeblocks still continues to impress me in every detail. ;) Thnx...
-
fyi : the common convention is in the release build to define NDEBUG, and don't define anything in debug build.
-
Yup I know, I guess it's because of the 'assert' macro. ;) Thnx anyway.