In CodeBlocks C++ project, settings, compiler, #define, I added these options:
_DEBUG
DATA_DIR=\"/media/Shared/SiX/Data\"
This produces the following command line:
g++ -Wall -g -fPIC -save-temps -D_DEBUG -DDATA_DIR=\"/media/Shared/SiX/Data\" -I../Includes -c /media/Shared/SiX/SiXConfiguration/PathManager.cpp -o obj/Debug/PathManager.o
When I open precompiler output, I see that source code line with DATA_DIR constant is expanded incorrectly. Source line:
commonDataDir = DATA_DIR;
is expanded as:
commonDataDir = /media/Shared/SiX/Data;
Should be:
commonDataDir = "/media/Shared/SiX/Data";
The same settings in the Eclipse CDT produce correct result. How can I fix this?
See what is the real command executed by Eclipse's CDT, then you'll know what to enter in the defines field.
I would try to replace \" with ".
Also reading the gcc docs about this expansion will help you a lot.
By the way this is not a C::B problem, but a configuration problem...
Thanks. Eclipse CDT produces command line with the same parameter: -DDATA_DIR=\"/media/Shared/SiX/Data\". Anyway, I solved the problem by changing the source code, as was suggested in another forum:
http://stackoverflow.com/questions/3959398/d-option-is-expanded-incorrectly-from-g-command-line/3959495#3959495