Link to home
Start Free TrialLog in
Avatar of Roger Alcindor
Roger Alcindor

asked on

BCB5 Where is WIN32 defined ?

I have the following line of code in one of my Borland C++ Builder 5 projects CPP modules

#define WIN32

This produces an error "Redefinition if WIN32 is not Identical"

I am not able to find any other re-definition by searching All Files in the project.

Can anyone advise me as to where WIN32 is originally defined ?
Avatar of jkr
jkr
Flag of Germany image

Taks a look at your project settings, it is likely that this is passed to the compiler as a command line option.
Avatar of Roger Alcindor
Roger Alcindor

ASKER

I am running the compiler from the IDE, not the command line.
 
Yes, I presumed that. That's why I suggested the settings.
There are no references to WIN32 under any of the tabs in Project|Options ??
Is there anything like "preprocessor definitions"?
No, there is no mention of preprocessors.

I have devised a workaround however, I preceed the #define WIN32 with  the line #undef WIN32

Possibly not the best solution but I have spent too much time on this issue already.

Well, instead uf an #undef, you could change that to
#ifndef WIN32
#define WIN32
#endif

Open in new window

SOLUTION
Avatar of tampnic
tampnic
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
you better remove the #define WIN32 statement in your code. such a basic macro never is defined in individual code but either in the compiler or project settings or in very basic header files of the libraries used. in the latter case it is done like jkr has shown cause a redefinition of that fundamental macro won't make a sense for any normal environment.

Sara

The reason that I included #define WIN32 in my code was due to the fact that a third party API  (supplied with PicoScope, the USB oscilloscope) would not work with my compiler without it.

By the way, changing #define WIN32 to  #define WIN32 1  does not fix the problem either.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The compiler isn't clever enough to realise you haven't actually redefined WIN32  with "#define WIN32 1" then. As sara says - #include <windef.h> should sort this out for you.

Cheers,
  Chris
Thanks for your help, I adopted Sara'smost recent comment and it fixed the problem.