Advertisement

Conditional compiling

Started by November 26, 2000 03:01 PM
2 comments, last by TwoFlower 24 years, 1 month ago
Hi, I''m using MSVC6 and would like to know how can I set up a define based on the configuration used. In a standard project, there is a Win32-Debug and a Win32-Release configuration, but I have created a couple of new ones for different rendering methods. The different configurations link to different libraries, but use exactly the same source files. I have set up a #define USE_RENDERERX in the header file, and used #ifdef USE_RENDERERX/#else/#endif so that only the code needed for a specific renderer is used. The trouble is, I have to change the #define line in the header file each time I want to compile a version to use a different renderer. I would much rather have this done automatically when I complie the different configurations. Can anyone help me on this please. Thanks
Add the appropriate define you want to the configuration of the project you are referring to.

Project->Settings->C/C++->PreProcessor Definitions.

Regards,
Jumpster
Regards,JumpsterSemper Fi
Advertisement
Perfect, that did the trick. Thanks a lot Jumpster.
If the interface of the rendering functions or methods are the same, you could use function or method pointers to switch at run time...
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara

This topic is closed to new replies.

Advertisement