SlickEdit Community
SlickEdit Product Discussion => SlickEdit® => Topic started by: SyRenity on August 17, 2006, 09:46:01 PM
-
Hi.
Is it possible to detect the selected project configuration, and then according to it include/exclude some code?
Something like this:
#ifdef Debug
//Run tests
#endif
Thanks.
-
I'm not sure exactly what you are asking, but two things come to mind.
1) Maybe View->Selective Display->Preprocessor Directives is what you're looking for.
Using the 'Scan for Defines' button makes it pretty easy.
We have quite a bit of old code that is littered with preprocessor junk, as we built for Mac/Win/Motif/OS2/dontRememberWhatElse.
The Selective Display capability is great, but you do need to be careful that you assign the right values to the tokens.
For example, we have tokens for a number of windowing systems:
#define MACWS 0
#define WINWS 1
#define PMWS 2
#define WMWS 3
#define X11WS 4
#define XOLWS 5
#define DWTWS 6
#define MTFWS 7
A lot of the conditional compiling is in blocks such as
#if XVTWS == WINWS
so you need to define both XVTWS and WINWS correctly, or you won't be looking at the code you want...
2) Look at the Project->Properties->Compile/Link tab. While I have no experience with it, it looks like it might be useful to you.
Maybe you could elaborate on what exactly you are trying to do?
-
Hi.
I have a test framework, which I want to include only for the Debug configuration. For the Release configuration, I need to exclude it. Hence, I thought about using #ifdef macros to define the framework usage code only for the Debug configuration.
Unfortunately, I couldn't find the exact method how to do it, although I found some examples for general gcc:
#ifdef _DEBUG
return TestRun();
#endif
I'm not locked on this approach, any other idea of how to achieve the above will be very welcomed.