LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating and using compiler defines

I'm having trouble doing this successfully. Can anyone tell me what I'm
doing wrong?


I'm running LabWindows/CVI 5.0 under WinNT 4.0. I have it installed for
compatibility with Visual C/C++.


In my code, I have

#ifdef MY_DEF

#else

#endif

I want stmt-a to be run but not stmt-b, so I tried to define MY_DEF. In
the project window, under menu option Options|Compiler Defines, I now
have:

/MY_DEF=1 /DWIN32_LEAN_AND_MEAN


But when I run the project, stmt-b gets run but not stmt-a.


Then I tried:

#ifdef MY_DEF

#endif
#ifndef MY_DEF

#endif


And again stmt-b gets run but not stmt-a.


TIA for any help.


B
--
ande at san dot rr dot com
0 Kudos
Message 1 of 3
(3,733 Views)
BA wrote:

> In my code, I have
>
> #ifdef MY_DEF
>
> #else
>
> #endif
> /MY_DEF=1 /DWIN32_LEAN_AND_MEAN

I thought that somewhere (like in a .h file) you had to to
#define MY_DEF 1

Been a long time since I did C but it is worth a try.
Kevin Kent
0 Kudos
Message 2 of 3
(3,733 Views)
Hi Ande,
You need the D after the /. Options|Compiler Defines should be
/DMY_DEF=1 /DWIN32_LEAN_AND_MEAN

For your purposes, the =1 is optional.
Regards,
Reed.


BA wrote in message <382720B9.94FF2463@san.rr.com>...
>I'm having trouble doing this successfully. Can anyone tell me what I'm
>doing wrong?

>I want stmt-a to be run but not stmt-b, so I tried to define MY_DEF. In
>the project window, under menu option Options|Compiler Defines, I now
>have:
>
>/MY_DEF=1 /DWIN32_LEAN_AND_MEAN

>TIA for any help.
>
>
>B
>--
>ande at san dot rr dot com
0 Kudos
Message 3 of 3
(3,733 Views)