Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: shenc on February 03, 2017, 10:00:13 pm

Title: passing string as "Custom variables" or "#define" breaks the CB
Post by: shenc on February 03, 2017, 10:00:13 pm
I need to pass a version string from makefile so I define it as -DVERSION='"1.1.1.0"' in "Other compiler option"  or in "#defines" field as VERSION='"1.1.1.0"'.  It breaks CB, CB does not compile.  If I remove this string  CB compiles.  So I am sure it is this string breaks CB.
I also tried
-DVERSION='\"1.1.1.0\"'
-DVERSION=\'"1.1.1.0"\'

only
-DVERSION=\'"1.1.1.0"\'

works.

Title: Re: passing string as "Custom variables" or "#define" breaks the CB
Post by: oBFusCATed on February 04, 2017, 01:32:01 am
What do you mean by breaks?
Title: Re: passing string as "Custom variables" or "#define" breaks the CB
Post by: shenc on February 06, 2017, 08:59:25 pm
CB does not compile.  BTW, when I copy the project to other location.  CB changes \'"1.1.1.0"\'  to /'"1.1.1.0"/'  by itself.  I need change it back to \'"1.1.1.0"\' to compile.  The behavior is verified.  I think it is a bug.

Title: Re: passing string as "Custom variables" or "#define" breaks the CB
Post by: oBFusCATed on February 07, 2017, 12:12:05 am
My magic ball is broken. Please describe the problem in better detail!
Title: Re: passing string as "Custom variables" or "#define" breaks the CB
Post by: sodev on February 07, 2017, 01:17:27 am
The question is most likely how to properly quote #defines in the compiler settings to define a value for a #define that wouldnt work in a plain way e.g. if it contains spaces. Various forms of different quoting either break the assembly of the compile command so that strange errors happen or CodeBlocks habits to switch path separators around break the quoting.