Build programs

  • Thread starter Thread starter Aaron
  • Start date Start date
A

Aaron

I made two versions of a program, one of them deals with euro and the other
deals with us dollar. I was wondering instead of creating two seperate
projects, is it possible to add a function that tells the compiler what to
include in the final exe/assembly?
ie

string prgmMode = "dollar";
if (prgmMode = "dollar")
dollarFunction();
else if (prgmMode = "euro")
euroFunction();

this does work but i only want to include one of the functions in the
exe/assembly not both.

Thanks in advance,
Aaron
 
You can use conditional compilation parameters...

#ifdef EURO
// Euro function here
#endif

Then simply add EURO as a conditional compilation symbol. Normally at the
command line this is simply using the /D:EURO flag, but there is some config box
in VS for you to do this as well.
 
Aaron,
I made two versions of a program, one of them deals with euro and the other
deals with us dollar. I was wondering instead of creating two seperate
projects, is it possible to add a function that tells the compiler what to
include in the final exe/assembly?
ie

string prgmMode = "dollar";
if (prgmMode = "dollar")
dollarFunction();
else if (prgmMode = "euro")
euroFunction();

this does work but i only want to include one of the functions in the
exe/assembly not both.

An alternative approach is to use a delegate -- call it
"appropriateMoneyFunction" and resolve it when you know what the program
mode is.

Regards,

Randy
 
Back
Top