Author Topic: Bug : broken gcc linux command line with litteral string #define  (Read 5618 times)

Offline earlgrey

  • Multiple posting newcomer
  • *
  • Posts: 101
Bug : broken gcc linux command line with litteral string #define
« on: December 19, 2010, 08:55:33 am »
When adding a string definition as a C define this way,

  Project::Properties, tab "compiler settings", subtab "#define"
  then add : STRING='"foo"'

it brakes the compiler command line, saying "g++ : no input files" :


-------------- Build: Debug in libfoldview2 ---------------

g++ -Wall -I"../../gnome-commander" -I"../../gnome-commander/src" -I"../../gnome-commander/src/foldview" -D_REENTRANT -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/directfb -I/usr/include/libpng12 -I/usr/include/pixman-1    -pthread -DORBIT2=1 -I/usr/include/gnome-vfs-2.0 -I/usr/lib/gnome-vfs-2.0/include -I/usr/include/gconf/2 -I/usr/include/orbit-2.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include    -DORBIT2=1 -pthread -I/usr/include/libgnome-2.0 -I/usr/include/orbit-2.0 -I/usr/include/gconf/2 -I/usr/include/gnome-vfs-2.0 -I/usr/lib/gnome-vfs-2.0/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libbonobo-2.0 -I/usr/include/bonobo-activation-2.0    -DORBIT2=1 -pthread -D_REENTRANT -I/usr/include/libgnomeui-2.0 -I/usr/include/libart-2.0 -I/usr/include/gconf/2 -I/usr/include/gnome-keyring-1 -I/usr/include/libgnome-2.0 -I/usr/include/libbonoboui-2.0 -I/usr/include/libgnomecanvas-2.0 -I/usr/include/gtk-2.0 -I/usr/include/gnome-vfs-2.0 -I/usr/lib/gnome-vfs-2.0/include -I/usr/include/orbit-2.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libbonobo-2.0 -I/usr/include/bonobo-activation-2.0 -I/usr/include/libxml2 -I/usr/include/pango-1.0 -I/usr/include/gail-1.0 -I/usr/include/freetype2 -I/usr/include/atk-1.0 -I/usr/lib/gtk-2.0/include -I/usr/include/cairo -I/usr/include/directfb -I/usr/include/libpng12 -I/usr/include/pixman-1    -DCODEBLOCKS -DSTRING='"foo"'  -g -Wno-unused-label     -c /home/gwr/Src/CPP/Anjuta/gcmd/git/gnome-commander/src/foldview/gnome-cmd-connection-treeview-control.cc -o obj/Debug/gnome-commander/src/foldview/gnome-cmd-connection-treeview-control.o
g++: no input files
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings


It seems that the command line is truncated after the second quote ('), because when pasting the g++ command line above in a terminal, it does compile.

Precision : I am using Bash linux shell, under whom quoting  ( ' character ) prevent shell expansion, so my define is equivalent to insert #define STRING "foo" in the code. Without the quote, bash would remove the " characters.
* OS = Debian Buster - Linux 4.19.06 x64 SMP
* C::B = svn11267 wx-3.0.4 - Linux, unicode 64 bit

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Bug : broken gcc linux command line with litteral string #define
« Reply #1 on: December 19, 2010, 09:59:46 am »
C::B does not use the shell to run the commands in, it uses wxExecute, which uses system calls, if I remember correctly.

It works (at least here on debian), if you escape the single quotes:
Code
STRING=\'"foo"\'

Offline earlgrey

  • Multiple posting newcomer
  • *
  • Posts: 101
Re: Bug : broken gcc linux command line with litteral string #define
« Reply #2 on: December 19, 2010, 10:08:45 am »
Bug closed  :)
* OS = Debian Buster - Linux 4.19.06 x64 SMP
* C::B = svn11267 wx-3.0.4 - Linux, unicode 64 bit