English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

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 ><. Any help would be greatly appreciated. Thanks in advance.

2007-08-17 05:54:58 · 3 answers · asked by SchweppesAle 2 in Computers & Internet Programming & Design

here's the compile error I'm getting

------ Build started: Project: Window, Configuration: Debug Win32 ------
Compiling...
Window.cpp
c:\documents and settings\john tripi\my documents\visual studio 2005\projects\brand new\my calculator\window\window\window.cpp(1) : fatal error C1083: Cannot open include file: 'Windows.h': No such file or directory
Build log was saved at "file://c:\Documents and Settings\John Tripi\My Documents\Visual Studio 2005\Projects\Brand New\My Calculator\Window\Window\Debug\BuildLog.htm"
Window - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


I've tried windows.h, WINDOWS.h, and Windows.h thinking maybe it's case senstive but nothing works. Here's the code I'm currently trying to use.

#include "Windows.h"

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nShowCmd)

{
MessageBox(NULL, "All your base are belong to us!",
"Hello World", MB_OK | MB_ICONEXCLAMATION);

2007-08-17 06:26:00 · update #1

3 answers

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

2007-08-17 08:24:32 · answer #1 · answered by christnp 7 · 0 0

#include

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.

2007-08-17 12:59:35 · answer #2 · answered by mdigitale 7 · 0 0

use #include

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

2007-08-17 14:32:07 · answer #3 · answered by Anonymous · 0 0

fedest.com, questions and answers