Definition of WINVER

F

Felix

Hello,

Using someting like #define WINVER 0x0500 in a header file works
perfect, i.e. the preprocessor sees the definition. But I would like to set
WINVER in the IDE (Properties -> C/C++ -> Preprocessor -> Preprocessor
Definitions).
Doing this the symbol seems not to get defined and the preprocessor sets
WINVER to a default value of 0x0501.
Defining a symbol MY_TEST in the IDE shows the same problem: it's
simply not seen as defined by the preprocessor.

Any idea what's wrong ?

Many thanks Felix


PS: Im am using Visual Studio .NET 2003
 
J

Jochen Kalmbach [MVP]

Hi Felix!
Using someting like #define WINVER 0x0500 in a header file works
perfect, i.e. the preprocessor sees the definition. But I would like to set
WINVER in the IDE (Properties -> C/C++ -> Preprocessor -> Preprocessor
Definitions).
Doing this the symbol seems not to get defined and the preprocessor sets
WINVER to a default value of 0x0501.
Defining a symbol MY_TEST in the IDE shows the same problem: it's
simply not seen as defined by the preprocessor.

How have you defined it?
You should add:

other-defines,WINVER=0x0500

You also should define "_WIN32_WINNT" and "_WIN32_IE"

If you have the latest PSDK you could also use the "NTDDI_WIN2K" macros...
See: Using the Windows Headers
http://msdn.microsoft.com/library/en-us/winprog/winprog/using_the_windows_headers.asp

Any idea what's wrong ?

Many thanks Felix


PS: Im am using Visual Studio .NET 2003


--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
 
F

Felix

I did exactly what you mentioned: added WINVER=0x0500 in the window that
appears when I select Properties -> C/C++ -> Preprocessor -> Preprocessor
Definitions.
There is not really much one can do wrong here?
I also tried to check and uncheck 'Inherit from project defaults' but this
did not help.

Any other idea?
 
B

Bruno van Dooren

Felix said:
I did exactly what you mentioned: added WINVER=0x0500 in the window that
appears when I select Properties -> C/C++ -> Preprocessor -> Preprocessor
Definitions.
There is not really much one can do wrong here?
I also tried to check and uncheck 'Inherit from project defaults' but this
did not help.

Any other idea?

If you look at the compiler command line command (you can find this in the
buildlog.htm file)
what does it look like? does it have /D "WINVER=0x500" somewhere?

another possibility is that WINVER is explicitly set to something else in
your main include file, for example in StdAfx.h?
Also, it could be that if you did not recompile StdAfx.cpp, the compiler
still uses the WINVER that was used when StdAfx.cpp was compiled previously.
It depends on the original settings in your project.

--

Kind regards,
Bruno.
(e-mail address removed)
Remove only "_nos_pam"
 
F

Felix

Many thanks for the tip Bruno,

I just did not check the buildlog.html file. After doing so there is no good
as
I already stated the IDE seems to completly ignore what I enter, i.e. I can
not find
the expected WINVER=0x0500 in in buildlog.html.
Please note that it's not a WINVER specific problem since any /D I enter is
ignored by
the IDE and does not appear in the build log.

Very strange ..., ?!
 
J

Jochen Kalmbach [MVP]

Hi Felix!
I just did not check the buildlog.html file. After doing so there is no good
as
I already stated the IDE seems to completly ignore what I enter, i.e. I can
not find
the expected WINVER=0x0500 in in buildlog.html.
Please note that it's not a WINVER specific problem since any /D I enter is
ignored by
the IDE and does not appear in the build log.

Very strange ..., ?!

Can you reduce the project to a minimum and then sent it to me?
jochen addd kalmbachnet dotttttt de


--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
 
F

Felix

First of all, many thanks for all of your help!

The problem is resolved now. In one of my earlier posts I stated
that I have checked the project settings for the preprocessor, including
the option 'Inherit from project defaults'. This is true but I missed to
check
this option for _each_ sourcefile in my project, which in the end reveald
the
error: sourcefiles generating the 'WINVER not defined' message all had
the option 'Inherit from project defaults' _not_ checked and therefore the
preprocessor settings (including WINVER=0x0500 of course) were overwritten
'localy' for those sourcefiles.
Deleting all 'local' preprocessor settings and setting the 'Inherit from
project defaults'
option for those sourcefiles resolved the problem.

Either these settings have never been correct or there must have been some
change when I moved from VC6 to VC.NET.

again many thanks for your help, Felix
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top