Tuesday, July 14, 2009

Using Windows.h in C++?

hi, I'm a new c++ programmer who's trying to learn more about windows programming. I'm currently working with Visual C++ 5.0 Express and I've downloaded then installed the Platform SDK package. Unfortunately, I'm still having trouble including the windows.h package. I've been told that all I need to do is include the correct libraries..I just have no idea how to do that yet %26gt;%26lt;. Any help would be greatly appreciated. Thanks in advance.

Using Windows.h in C++?
The compiler doesn't know where to find windows.h. You can either put the whole path in front of the file name, or you can teach VC++ where to look. Eventually you'll need to link to the lib files too, so may as well configure VC++ to know where everything is...





I don't have 5.0 Express, so I can't tell you exactly what menus to look for. In my version of VC++, it's under Tools\Options. Tab over to directories, and add the include and lib directories for your SDK, and also the directories for your VC++ installation.





Here's an example, but you'll need to find the appropriate paths on your machine (hint. Just search for Windows.h, then copy the path)





Include files:


C:\Program Files\Microsoft SDK\Include


C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE


(plus I have lots more)





Lib files:


C:\Program Files\Microsoft SDK\Lib


C:\Program Files\Microsoft Visual Studio\VC98\LIB


(etc.)
Reply:#include %26lt;windows%26gt;





I don't use VC++ so I'm not sure what you're seeing...but in Borland and Metrowerks it really is as simple as the above.
Reply:use #include %26lt;windows.h%26gt;





windows is in include folder path .. not in the project..


No comments:

Post a Comment