LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Excluding lines from source code

Hi,

I would like to conditionally exclude some lines of code from my source.
In the past, I've used #ifdef <MYMACRO>/#else/#endif constructs with command
line compilers. I would like to do the same with LabWindows. However I
can't find anything in the IDE where I can pass a "command line" argument
like -D<MYMACRO> to the LabWindows compiler (and have it saved as part of
the project). I really don't want to add a dummy header file (.h) which
defines <MYMACRO>.

The one thing I did find is the "Toggle Exclusion" item in the Edit menu.
The only problem with this is that the excluded line information is not
saved with the project. If I "resolve the exclusion" then the change is
associated with the source file and I don't want the exclusions in other
projects that use the same source.

Does anyone know of some way to solve this?

Thanks,
Chandan
0 Kudos
Message 1 of 3
(3,611 Views)
Of course, about 2 minutes after I posted the original message, I found what I wanted
under Options->Build Options. I had been desperately looking under the Build menu.

Chandan
0 Kudos
Message 2 of 3
(3,609 Views)
That's great that you found the solution.  You may also find this useful.   _CVI_DEBUG_ is defined to be 1 if the Build==> Configuration is set to debug mode.  It can be used in #ifdef statements to exchange or exclude code based on the configuration setting being Release or Debug. 
Message 3 of 3
(3,586 Views)