Archived

This topic is now archived and is closed to further replies.

Brobanx

win32, WTH?

Recommended Posts

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...)?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
This has nothing to do with whether you have WinXp or not:

#if (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)
WINBASEAPI
BOOL
WINAPI
IsDebuggerPresent(
VOID
);
#endif

You could be building on a Mac for all the compiler cares. What matters is your target platform.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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]


Share this post


Link to post
Share on other sites