Solved

BCB5 Where is WIN32 defined ?

Posted on 2011-09-19
13
507 Views
Last Modified: 2012-05-12
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 ?
0
Comment
Question by:alcindor
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 2
  • +1
13 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 36562492
Taks a look at your project settings, it is likely that this is passed to the compiler as a command line option.
0
 
LVL 2

Author Comment

by:alcindor
ID: 36562728
I am running the compiler from the IDE, not the command line.
 
0
 
LVL 86

Expert Comment

by:jkr
ID: 36562788
Yes, I presumed that. That's why I suggested the settings.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Author Comment

by:alcindor
ID: 36563060
There are no references to WIN32 under any of the tabs in Project|Options ??
0
 
LVL 86

Expert Comment

by:jkr
ID: 36563110
Is there anything like "preprocessor definitions"?
0
 
LVL 2

Author Comment

by:alcindor
ID: 36563227
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.

0
 
LVL 86

Expert Comment

by:jkr
ID: 36563261
Well, instead uf an #undef, you could change that to
#ifndef WIN32
#define WIN32
#endif

Open in new window

0
 
LVL 7

Assisted Solution

by:tampnic
tampnic earned 200 total points
ID: 36565807
WIN32 is defined in windef.h as "#define WIN32 1"
You could just change your existing line of code to match or follow jkr's advice to use the #ifndef directive - both will work

The windef.h file will reside wherever BCB5 installed the Windows header files, or where you have installed the Windows SDK you are compiling with.

Cheers,
  Chris
0
 
LVL 34

Expert Comment

by:sarabande
ID: 36566191
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
0
 
LVL 2

Author Comment

by:alcindor
ID: 36566390

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.
0
 
LVL 34

Accepted Solution

by:
sarabande earned 300 total points
ID: 36566852
the third party API probably is not well prepared for Borland environment.

you could add the #include <windef.h> above the first header of the API - see comment of tampnic - what would solve the issue.

Sara
0
 
LVL 7

Expert Comment

by:tampnic
ID: 36567348
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
0
 
LVL 2

Author Closing Comment

by:alcindor
ID: 36572426
Thanks for your help, I adopted Sara'smost recent comment and it fixed the problem.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question