#### Archived

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

# win32, WTH?

This topic is 5884 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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 on other sites
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.

##### Share on other sites
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?

##### 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 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 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]

1. 1
2. 2
Rutin
18
3. 3
4. 4
5. 5
frob
12

• 9
• 21
• 11
• 9
• 17
• ### Forum Statistics

• Total Topics
632606
• Total Posts
3007383

×