User forums > Using Code::Blocks
Defines : how to use ?
stahta01:
The standard location in CB is
Project -> Build Option
Compiler Tab; #defines Tab
MortenMacFly:
In the defines tab you have to put DEBUG=1. Notice no spaces and the equality sign.
Edit: Anyway, I tried and it should also work with only having "DEBUG" in the defiens tab.
Did you...
- put the define in a wrong target (e..g in the release target but compiled the debug target?!)
- forget to re-compile after you had changed the define?
- do you set DEBUG=0 somewhere in the code that gets included?
With regards, Morten.
MortenMacFly:
--- Quote from: xurei on October 08, 2006, 01:57:44 pm ---I tried this :
--- Code: ---#ifndef ZAFDSGERGEG
cout << "debug" << endl;
#endif
--- End code ---
with ZAFDSGERGEG defined....
And it showed "debug" : it shouldn't :x
--- End quote ---
Works very well for me. Did you forget to re-compile?
With regards, Morten.
xurei:
Okay, here's my real code :
--- Code: ---/* debug.h */
#ifdef ZAFDSGERGEG
#include <iostream>
using namespace std;
#define echo(text) cout << text
#else
#define echo(text)
#endif
--- End code ---
This code is helpful to show somemore informations when I'm debugging my sources...
And for your questions :
--- Quote ---Did you...
- put the define in a wrong target (e..g in the release target but compiled the debug target?!) NO
- forget to re-compile after you had changed the define? NO (maybe yes actually, but I just recompile completely and the problem is still present...)
- set DEBUG=0 somewhere in the code that gets included? NO
--- End quote ---
It is not the first time I tried to use the defines, but it never worked...
xurei:
Ok, I reinstalled C::B, and now it works...
Thank you for the help !
xurei
Navigation
[0] Message Index
[*] Previous page
Go to full version