win32, WTH?

Started by
5 comments, last by Brobanx 21 years, 9 months ago
I''m running on Windows XP Professional. I have a basic program, which looks like this...
  
#include <windows.h>

int WINAPI
WinMain( HINSTANCE, HINSTANCE, LPSTR, int) {
    if ( IsDebuggerPresent())
      system("PAUSE");
    return 0;
}
  
Now for some reason, it says that IsDebuggerPresent is unidentified. In the docs, it says I need Win98 or above, or WinNT 4.0 and above to use this function. I have WinXP Pro, so why doesn''t it say I have it. I looked at the winbase.h file (where IsDebuggerPresent is declared), and it shows this: #if (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400) WINBASEAPI BOOL WINAPI IsDebuggerPresent( VOID ); #endif So, that means that for some reason VC++ is not declaring the _WIN32_WINDOWS (maybe _WIN32_WINNT, which does XP qualify as?) macros properly. Even after re-installing MSVC, getting service pack 5, and even downloading and installing a new version of the win32 platform SDK, I still receive the same errors, and MSVC is not properly setting these macros. Does anyone know a fix to this, or perhaps I have to set the macro myself in the project settings (I doubt that''s the right way to do it...)?
Advertisement
This has nothing to do with whether you have WinXp or not:
#if (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)WINBASEAPIBOOLWINAPIIsDebuggerPresent(VOID);#endif 

You could be building on a Mac for all the compiler cares. What matters is your target platform.
Now for some reason, it says that IsDebuggerPresent is unidentified.
Could you give the exact error (literal quote)? Have you taken a look at the MSDN entry for the specified error?
c:\1\testwin32\main.cpp(7) : error C2065: ''IsDebuggerPresent'' : undeclared identifier

That''s the exact error message. I think AP was right, my target platform is not necessarily WinXP, even though im running WinXP. I''d now like to know, how do I change the target platform in MSVC? I can''t find anything useful about that on MSDN, and the only option for a target platform I can find is "Win32", and it doesn''t let me specify which version.
Put
#define _WIN32_WINNT 0x400
before including windows.h in your main.cpp file.

Edit: MSDN Docs: "To compile an application that uses this function, define the _WIN32_WINNT macro as 0x0400 or later. For more information, see Using the SDK Headers."

Freeware development:
http://www.ruinedsoft.com/

[edited by - iwasbiggs on August 12, 2002 9:27:42 PM]
___________________________Freeware development:ruinedsoft.com
u need to download the latest platform sdk, they include the latest headers and libs
quote:Original post by iwasbiggs
Put
#define _WIN32_WINNT 0x400
before including windows.h in your main.cpp file.

Edit: MSDN Docs: "To compile an application that uses this function, define the _WIN32_WINNT macro as 0x0400 or later. For more information, see Using the SDK Headers."

Freeware development:
http://www.ruinedsoft.com/

[edited by - iwasbiggs on August 12, 2002 9:27:42 PM]


daerid@gmail.com

This topic is closed to new replies.

Advertisement