Thread: windows.h no such file or directory

  1. #1
    Codigious FingerPrint's Avatar
    Join Date
    Mar 2006
    Posts
    60

    windows.h no such file or directory

    I am working on getting a new compiler and the one im looking at is MVC(not sure if the ++ are included on the end lol). Anyways, my current compiler is Dev 4.9.2 and it compiles and runs my program just fine. But when I moved the code over to the MVC and tried it, it didnt work. I got the same error multiple times. So then I downloaded Platform SDK and added in the lib,bin and include files I was supposed to. I also changed a line of code that had kerbel.lib or something like that on it(which I was supposed to do). And I still cant get it to work.

    here is the error message:

    Code:
     fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
    This is how I used it in the actual code:

    Code:
    #include <iostream>
    #include <windows.h>
    I tried changing windows.h to windows and that didnt work either. So im nnot really sure wat else to do. If someone could explain to me why it doesnt work and/or how to fix it that would be great.
    Last edited by FingerPrint; 08-21-2006 at 04:46 AM.
    Code:
    /* ------------------------------------------------------------------*/
                               // INSERT CODE HERE
    /* ------------------------------------------------------------------*/

  2. #2
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    did you follow all the installation steps ?

  3. #3
    Codigious FingerPrint's Avatar
    Join Date
    Mar 2006
    Posts
    60
    I didn't see step 5 the first time through(I was in a hurry and didnt scroll down that far). Anyways, I commented out the for lines that it says t comment out. Then it says:

    Code:
    From the File menu, click New Project. In the New Project dialog box, 
    expand the Visual C++ node in the Product Types tree and then click 
    Win32. Click on the Win32 Console Application template and then give 
    your project a name and click OK. In the Win32 Application Wizard 
    dialog box, make sure that Windows application is selected as the 
    Application type and the ATL is not selected. Click the Finish button 
    to generate the project.
    Code:
    In the Win32 Application Wizard dialog box, make sure that Windows 
    application is selected as the Application type 
    
    /* On this part it wont let me select windows application. 
    Only console application. */
    I did exactly what it said but cant finish it because I cant make a windows app. And I have no idea why I cant.
    Code:
    /* ------------------------------------------------------------------*/
                               // INSERT CODE HERE
    /* ------------------------------------------------------------------*/

  4. #4
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    If you were in a hurry then, double check now if you have the needed paths on the include list.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  5. #5
    Codigious FingerPrint's Avatar
    Join Date
    Mar 2006
    Posts
    60
    Well, I'm glad you said that mario. I did add the paths I was supposed to add, but I added all 3 of them into the executables. I fixed that part. But I still got the error when I ran my program, and I still cant make a windows app. I still can only make a console app.

    I also just noticed another thing. On the page Ancient Dragon pointed out says to comment out lines 441-444

    Code:
    // WIN_APP.disabled = true;
    // WIN_APP_LABEL.disabled = true; 
    // DLL_APP.disabled = true; 
    // DLL_APP_LABEL.disabled = true;

    in C:\Program Files\Microsoft Visual Studio 8\VC\VCWizards\AppWiz\Generic\Application\html\103 3. I went there, opened the file in Notepad(it mentioned opening it in a text editor) and looked for the 4 lines. Well, I only found these 3 lines.

    Code:
    // WIN_APP.disabled = true;
    // DLL_APP.disabled = true;
    // LIB_APP.disabled = true;
    So, should I just replace the 3 lines I have with the 4 lines it says should be commented out. Or could this really screw up the program?

    EDIT: Ok cool. I found the 4 lines. I didnt notice them the first few searches. But I just found them and commented them out. Its working a'ok now.


    RE-EDIT!: Bah! Ok, I thought it was working but unfortunately it isnt. I can now make windows apps and dll's. Yet it still says that there is no winows.h. I just dont get it, ive done all the install steps. All the other headers work just fine. I dont know what else to do from here. It works just fine in Dev C++. Is there some stupidly obvious lib im supposed to add or something?
    Last edited by FingerPrint; 08-24-2006 at 04:43 PM.
    Code:
    /* ------------------------------------------------------------------*/
                               // INSERT CODE HERE
    /* ------------------------------------------------------------------*/

  6. #6
    Codigious FingerPrint's Avatar
    Join Date
    Mar 2006
    Posts
    60
    Well, I did a google search and it seems a ton of people are having this problem. Ill keep working at it but I think I might as well go back to Dev C++ or find some other compiler. Thanks for the help though.
    Code:
    /* ------------------------------------------------------------------*/
                               // INSERT CODE HERE
    /* ------------------------------------------------------------------*/

  7. #7
    Registered User
    Join Date
    Aug 2006
    Posts
    62
    Allright, I think I figured out the problem; It is with microsoft's website itself; The paths that they provide are inaccurate; It says:

    Code:
    Step 3: Update the Visual C++ directories in the Projects and Solutions section in the Options dialog box.
    
    Add the paths to the appropriate subsection:
    
    Executable files: C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin
    
    Include files: C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include
    
    Library files: C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib
    But it should actually say:

    Code:
    Step 3: Update the Visual C++ directories in the Projects and Solutions section in the Options dialog box.
    
    Add the paths to the appropriate subsection:
    
    Executable files: C:\Program Files\Microsoft Platform SDK\Bin
    
    Include files: C:\Program Files\Microsoft Platform SDK\Include
    
    Library files: C:\Program Files\Microsoft Platform SDK\Lib
    At least that worked for me; But if that doesn't work for you, all you have to do is when you are adding a path, instead of copying and pasting the path, click on the "..." button at the end of the box and then browse to the directory that Microsoft PSDK is saved at, then doubleclick on "Bin", "Include", or "Lib" depending on what path you are changing; This should work;

  8. #8
    Registered User
    Join Date
    Aug 2006
    Posts
    62

    The #include <windows.h> not working problem...SOLVED!

    Okay, I have noticed a lot of people having this problem(myself included), on this board, and all accross google; I think that I have discovered the error though; The error is with microsoft's "using platform sdk with visual c++" instruction page, which is located at http://msdn.microsoft.com/vstudio/ex...k/default.aspx; The paths that they provide are inaccurate; It says:

    Code:
    Step 3: Update the Visual C++ directories in the Projects and Solutions section in the Options dialog box.
    
    Add the paths to the appropriate subsection:
    
    Executable files: C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin
    
    Include files: C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include
    
    Library files: C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib
    But this is incorrect; It should actually say:

    Code:
    Step 3: Update the Visual C++ directories in the Projects and Solutions section in the Options dialog box.
    
    Add the paths to the appropriate subsection:
    
    Executable files: C:\Program Files\Microsoft Platform SDK\Bin
    
    Include files: C:\Program Files\Microsoft Platform SDK\Include
    
    Library files: C:\Program Files\Microsoft Platform SDK\Lib
    If that doesn't work for you, all you have to do is when you are adding a path, instead of copying and pasting the path, click on the "..." button at the end of the box and then browse to the directory that Microsoft Platform SDK is saved at, then doubleclick on the folder named "Bin", "Include", or "Lib", depending on what path you are changing; This worked for me, so chances are it will also work for you;

  9. #9
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Interesting. I installed Platform SDK, and the correct path is what is given by Microsoft's directions. Which version of the PSDK did you download and install?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  10. #10
    Registered User
    Join Date
    Aug 2006
    Posts
    62
    Quote Originally Posted by laserlight
    Interesting. I installed Platform SDK, and the correct path is what is given by Microsoft's directions. Which version of the PSDK did you download and install?
    the at this address http://www.microsoft.com/downloads/d...displaylang=en

  11. #11
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Then you probably downloaded the old version. The new version is also linked to from there, under the "Related Resources" section.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  12. #12
    Registered User
    Join Date
    Aug 2006
    Posts
    62
    Ah...Oh, well then I should prolly see about deleting this thread... God, I feel a little dumb now...Lol;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File Writing Problem
    By polskash in forum C Programming
    Replies: 3
    Last Post: 02-13-2009, 10:47 AM
  2. Inventory records
    By jsbeckton in forum C Programming
    Replies: 23
    Last Post: 06-28-2007, 04:14 AM
  3. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  4. archive format
    By Nor in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 08-05-2003, 07:01 PM
  5. Need a suggestion on a school project..
    By Screwz Luse in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 02:58 AM