PDA

View Full Version : Defining Preprocessor Constants



Patriot1776
February 8th, 2008, 01:16 AM
Okay, I'm compiling a C++ project using code somebody else has provided to me and I have a couple of preprocessor constants I need to define on the command-line before running g++. Can I define pre-processor constants in my makefile or scons SConstruct?

The two pre-processor constants I need to define before compiling the code are '_DENTONMOD' and '_PORTALSKY'.

hod139
February 8th, 2008, 01:57 AM
Not sure about scons, but you define preprocessor constants with gcc using -D. So, for your example, you would have

gcc -D_DENTONMOD

Patriot1776
February 8th, 2008, 02:28 AM
And is -D used for each constant you want to add?

hod139
February 8th, 2008, 02:52 AM
And is -D used for each constant you want to add?

Yes.

Patriot1776
February 8th, 2008, 03:15 AM
Thanks very, very much!