I have problems to compile 5.1.2 with MCF projects - both in VC6 and VC8.
The error is:
fatal error C1189: #error : WINVER and _WIN32_WINDOWS are not defined in a coherent way.
It came from _windows.h:
# if defined (WINVER) && defined (_WIN32_WINDOWS)
# error WINVER and _WIN32_WINDOWS are not defined in a coherent way.
The problem is that both WINVER and _WIN32_WINDOWS are defined somewhere deep inside in afxwin.h
Could anyone help me?
I just created a project using a wizard and add path to STLPort.
MSDN is not very clear on how WINVER and _WIN32_WINDOWS should be used, according this link
for a given platform WINVER and _WIN32_WINDOWS should always have the same value, this is what I am checking in this code.
What are the values for each macro in your MFC headers ?
What is your platform, which Windows ?
Maybe if _WIN32_WINNT is defined I shouldn't care about _WIN32_WINDOWS value.
Is _WIN32_WINNT defined for your platform ?
Thanks for the reply.
I compiled my VS8 MFC project by removing the following code from stdafx.h was generated:
#define WINVER 0x0501
I have W2k with both VS6 and VS8 installed. To the projects I generated I just added #define HAVE_STLPORT to my stdafx.h.
Here is what I found in VS6 files:
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VC98\MFC\Include\AFXV_W32.H(119):#define _WIN32_WINDOWS 0x0500
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VC98\MFC\Include\WINRES.H(25):#define WINVER 0x0400 // default to Windows Version 4.0
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VC98\ATL\SRC\STDAFX.H(6):#define _WIN32_WINNT 0x0400
How is urgent to set _STLP_WIN32_VERSION correctly? It this really critical to stop the compilation?
My applications (Win32) use dll version of runtime library, but I want stlport to be linked statically.
I faced the DLL hell because have applications compiled both for VS6 and VS8 and it's quite inconvenient because stlport has the same DLL name.
Is it possible to create stlport 5.1 library for static linkage but the library itself to use threaded DLL runtime library?
We use _STLP_WIN32_VERSION for 2 purposes:
- Detect Windows 95 platform that have a special behavior for the InterlockedIncrement function.
- Detect Windows 98 that is the first Windows platform that support InterlockedExchangeAdd function.
I just check the code and it is wrong, I say that values are not coherent without testing values to each other. You add the check like that:
# if defined (WINVER) && defined (_WIN32_WINDOWS) && (WINVER != _WIN32_WINDOWS)
even if according your values it might still give a #error
So I think that I am rather going to do something like that:
#if !defined (_STLP_WIN32_VERSION)
# if defined (WINVER) || defined (_WIN32_WINDOWS)
# if defined (WINVER)
# define _STLP_WIN32_VERSION WINVER
# define _STLP_WIN32_VERSION _WIN32_WINDOWS
No more #error, WINVER definition is prefered to _WIN32_WINDOWS, you can force a targetted Windows platform using _STLP_WIN32_VERSION (I will document it).
I confirmed that this fix resolved the problem for both VS6 and VS8.
Thank you very much.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.