User forums > Using Code::Blocks
Defines : how to use ?
xurei:
Hi there !
I'm using Code::Blocks since few years and I like it ! But there is an option that I cannot use, and I don't know what is wrong in my use... #defines.
Look : I create a target named "debug", with DEBUG 1 in the #defines tab. Then, I write :
--- Code: ---int main()
{
#ifdef DEBUG
cout << "debug" << endl;
#endif
/* ... */
return 0;
}
--- End code ---
It should show "debug" in the console, but it doesn't... What's wrong ?
Thank you !
PS : I'm using GNU GCC compiler...
xurei:
A lot of reads, but no answer.... Is it so complicated ? :P
stahta01:
It looks like it should work to me.
I would try using a define other than DEBUG; the standard is NDEBUG to say not debug.
and then to test for #ifndef NDEBUG
I am a C::B newbie, so there could be something C::B related that I don't understand.
Tim S
xurei:
I tried this :
--- Code: ---#ifndef ZAFDSGERGEG
cout << "debug" << endl;
#endif
--- End code ---
with ZAFDSGERGEG defined....
And it showed "debug" : it shouldn't :x
I really don't understand :?
stahta01:
Where are you defining it?
Navigation
[0] Message Index
[#] Next page
Go to full version