Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: amarty on September 16, 2008, 03:12:54 pm
-
Hello!
I am using C::B v. Release 8.02 under Windows and Linux.
In my project I add some defines in Project properties/Build options/Compiler settings/#defines
_MY_STRINGISE(name)=#name
MY_STRINGISE(name)=_MY_STRINGISE(name)
Under Window/MinGW compiling is successfull, but under Linux/gcc I get an error:
g++ -D_MY_STRINGISE(name)=#name -DMY_STRINGISE(name)=_MY_STRINGISE(name) ...
/bin/bash: -c: line 0: syntax error near unexpected token `('
It seems as the bash (sh) get wrong argument, I think it is need arguments to be quoted, like "-D...", but I can't found any option in C::B settings controling this.
Anybody knows solution for this problem?
-
-D name=definition
The contents of definition are tokenized and processed as if they appeared during translation phase three in a ‘#define’ directive. In particular, the definition will be truncated by embedded newline characters.
If you are invoking the preprocessor from a shell or shell-like program you may need to use the shell's quoting syntax to protect characters such as spaces that have a meaning in the shell syntax.
If you wish to define a function-like macro on the command line, write its argument list with surrounding parentheses before the equals sign (if any). Parentheses are meaningful to most shells, so you will need to quote the option. With sh and csh, -D'name(args...)=definition' works.
Quote from gcc-4.2 documentation.
Just quote the defines in the "Build options".
-
-D name=definition
...
If you wish to define a function-like macro on the command line, write its argument list with surrounding parentheses before the equals sign (if any). Parentheses are meaningful to most shells, so you will need to quote the option. With sh and csh, -D'name(args...)=definition' works.
Quote from gcc-4.2 documentation.
Just quote the defines in the "Build options".
Now I correct defines to (in project build options):
'_MY_STRINGISE(name)=#name'
'MY_STRINGISE(name)=_MY_STRINGISE(name)'
When compile, I get error from compiler:
g++ -D'_MY_STRINGISE(name)=#name' -D'MY_STRINGISE(name)=_MY_STRINGISE(name)' ...
g++: argument to '-D' missing
I think It must be as below:
g++ '-D_MY_STRINGISE(name)=#name' '-DMY_STRINGISE(name)=_MY_STRINGISE(name)' ...
but I don't know how to obtain this result. I think, the C::B must place all expression (with leadin -D) into quotes, but I can't find any option controling this.
-
Use double.quotes instead of single-quotes.
-
It's work. Thanks :D