943,671 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 3596
  • C++ RSS
You are currently viewing page 1 of this multi-page discussion thread
Mar 14th, 2009
0

windows.h error

Expand Post »
I am using this code here:
c++ Syntax (Toggle Plain Text)
  1. #include "stdafx.h"
  2. #include "windows.h"
  3.  
  4.  
  5. int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
  6. LPSTR lpCmdLine, int nCmdShow)
  7. {
  8. MessageBox(NULL, "Goodbye, cruel world!", "Note", MB_OK);
  9. return 0;
  10. }

But no matter what i do i keep getting this built error:


------ Build started: Project: Gui, Configuration: Debug Win32 ------
Compiling...
Gui.cpp
c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(236) : error C2146: syntax error : missing ';' before identifier 'PVOID64'
c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(236) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(7818) : error C2146: syntax error : missing ';' before identifier 'Buffer'
c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(7818) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(7818) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int


I was wondering if anyone will be able to help me out so it will be able to compile.

Cheers
Paul
Similar Threads
Reputation Points: 264
Solved Threads: 183
Veteran Poster
Paul Thompson is offline Offline
1,095 posts
since May 2008
Mar 14th, 2009
0

Re: windows.h error

I started a new empty windows project, pasted your code and it compiled without any errors or warnings. When you created your project did you create a console project or windows project. It must be a windows project.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is online now Online
21,949 posts
since Aug 2005
Mar 14th, 2009
0

Re: windows.h error

Yeah i am using the "Win32 Project" and even the default one dosent compile. Do i have to reinstall an SDK? Or is there something else?
Reputation Points: 264
Solved Threads: 183
Veteran Poster
Paul Thompson is offline Offline
1,095 posts
since May 2008
Mar 14th, 2009
0

Re: windows.h error

What version of Windows are you running? I have Vista but some people say that VC++ 6.0 doesn't work right on that os. Recommend you upgrade to the latest version of the compiler -- VC++ 2008 Express is free but doesn't support MFC.
Last edited by Ancient Dragon; Mar 14th, 2009 at 11:53 am.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is online now Online
21,949 posts
since Aug 2005
Mar 14th, 2009
0

Re: windows.h error

In addition to what Ancient already mentioned:
Change #include "windows.h" to #include <windows.h>
Moderator
Featured Poster
Reputation Points: 4142
Solved Threads: 394
Industrious Poster
Nick Evan is offline Offline
4,132 posts
since Oct 2006
Mar 14th, 2009
0

Re: windows.h error

Click to Expand / Collapse  Quote originally posted by niek_e ...
In addition to what Ancient already mentioned:
Change #include "windows.h" to #include <windows.h>
It really doesn't matter with that compiler.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is online now Online
21,949 posts
since Aug 2005
Mar 14th, 2009
0

Re: windows.h error

Yeah it runs on my second computer fine.. The only problem seems to be with winnt.h.. Should i just redownload that file from somewhere? And i am using XP, and Visual C++ 6
Reputation Points: 264
Solved Threads: 183
Veteran Poster
Paul Thompson is offline Offline
1,095 posts
since May 2008
Mar 14th, 2009
0

Re: windows.h error

try this. I have vc++ 6.0 sp 6 installed
Last edited by Ancient Dragon; Apr 13th, 2009 at 8:59 pm.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is online now Online
21,949 posts
since Aug 2005
Mar 15th, 2009
0

Re: windows.h error

With MSVC 6.0, the latest Windows SDK that can be used is the Windows Server 2003 Platform SDK

Either switch to that old SDK or get e.g. a VS Express edition, which works with your current SDK.
Last edited by mitrmkar; Mar 15th, 2009 at 3:09 am.
Reputation Points: 1105
Solved Threads: 389
Posting Virtuoso
mitrmkar is offline Offline
1,714 posts
since Nov 2007
Mar 16th, 2009
0

Re: windows.h error

Thanks Ancient Dragon, that fixed the issues with winnt.h, but winbase.h is stuffed. I think this comes from my brother trying direct x with no success some time ago.

So does anyone know where i can get a replacement winbase.h?

Or perhaps where i could just re-download all headers?
Last edited by Paul Thompson; Mar 16th, 2009 at 3:43 am.
Reputation Points: 264
Solved Threads: 183
Veteran Poster
Paul Thompson is offline Offline
1,095 posts
since May 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: windows api help
Next Thread in C++ Forum Timeline: Child removal problem with Xerces





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC