Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: eckard_klotz on September 19, 2012, 03:57:28 pm
-
Hello Everybody.
I tried to define in the build-options in the dialogue Project >> Build options >> Compiler-settings >> #defines (individual target setting) a preprocessor-variable with a value like here:
RELEASE 0
(trial to define the preprocessor-constant RELEASE with the value 0)
After starting the build-process (gnu-compiler) I've got the following error in the Build messages
File|Line|message |
0 | |No such file or directory|
In the Build log I found:
mingw32-g++.exe -Wall -fexceptions
-D__dsPIC30F4011__
-DSEND_HELLO_WORLD
-DUNITTEST
-DSHOW_FILE_OF_USE
-O2
-DRELEASE 0
-I..\..\..\..\.. (more include-pathes)
-c D:\... sorcepath ...\c\tst_pwm_oc.cpp
-o obj\Release_0\13_Tests_\UnitTest\TL\tst\c\tst_pwm_oc.o
mingw32-g++.exe: 0: No such file or directory
I assume that mingw (the compiler) is not able to understand that the character-sequence 0 should be the content of the preprocessor-constant RELEASE. Is this right? If yes, is there a possibility to change the configuration in the dialog so that the compiler gets an valid value-definition? Currently I use as a workaround a RELEASE_0 (without a value) in the compiler-settings of the project together with an external header-file with a compiler-switch like this:
#if defined(RELEASE_0)
#define RELEASE 0
#elif defined(RELEASE_1)
#define RELEASE 1
#elif defined(RELEASE_2)
#define RELEASE 2
#else
#endif
What is the way recommended by the C::B team?
Best regards,
Eckard Klotz.
PS.: I use the lates nigthly 8248 on windows xp sp3 together with mingw 4
-
Try this, IIRC it works.
-
Hello Stahta1.
Thanks for your fast response!
I tried it out and it works for mingw also. But it is very essential to use no whitespaces like this
That was my first try before I posted my questuion. By using spaces inside the definition the = and the 1 are not interpreted as part of the #define but as file-name.
Now if I think about, this makes sence. If the definition will only be copied into the argument-string of the called binary (the compiler) windos is using the white-space as splitt-character, what means the = and the 1 will be interpreted as independent arguments.
Pehaps it may be helpfull to add small hint or tool-tip into the configuration-dialogue that shows how to do it and how not. Alternativly this posted example may be used as part of a trouble-shooting list.
Thanks for your help,
Eckard Klotz.