I'm really new to C and Visual Studio, I know there are ifdef
and ifndef
to do the conditional compilation.
But my boss ask me to create 2 different configurations (similar to debug
and release
) to automate this. For example:
#if $(some_configuration_dependent_flag)
// I can do something specific for only config1
#endif
I've already checked the configuration manager, but the dialog is only used to enable/disable the projects in the solution. Where and how to define the variable some_configuration_dependent_flag
mentioned above?
CodePudding user response:
Visual Studio allows per config pre-processor definitions.
Use menu Project/Properties (on right click Properties on the project) to open the Property Page dialog
Then in C/C / Preprocessor, you find Preprocessor Definitions. You select the configuration you want to change, and can add or modify any definition.