locked
C1014: too many include files RRS feed

  • Question

  • Imported Petzold's Hellowin.c into VC++ 2010:

    /*------------------------------------------------------------

    HELLOWIN.C -- Displays "Hello, Windows 95!" in client area

    (c) Charles Petzold, 1996

    ------------------------------------------------------------*/

     

    #include

     

    <windows.h>

    LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;

    etc.

    Build fails with:

    C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\windows.h(1): fatal error C1014: too many include files : depth = 1024

    Any ideas?

     

    Monday, September 5, 2011 12:51 AM

Answers

  • >I created a new empty project using General, Empty Project;
    > add new file, copy and paste text from
    >C:\PETZOLD\CH02\hellowin.c.

    If you do it that way, you will also have to set one or
    more settings in the project properties. e.g. -
    the SubSystem under the Linker/System properties
    will need to be set to /SUBSYSTEM:WINDOWS

    >Empty Project with #include <windows.h> gets same result.

    Sounds like you have a problem with your installation
    of the Win32 SDK.

    >Cannot get Stroustrup's Hello World program to run either
    >(won't recognise cout) from <stream.h> or <iostream.h>

    Headers in VC++ 2010 don't have the .h extension.
    Also, the streams and STL are in the std namespace.

    #include <iostream>
    using namespace std;

    - Wayne
    • Marked as answer by zrtf90 Monday, September 5, 2011 9:04 PM
    Monday, September 5, 2011 11:12 AM

All replies

  • What type of project did you create?

    Using which template?

    What happens when you create a simple project and just
    put the #include <windows.h> in it?

    Have you successfully created other Windows projects?

    Are you adding this code to a project that you previously
    built with different code?

    Do you have precompiled headers enabled in the project?

    - Wayne
    Monday, September 5, 2011 7:00 AM
  • Hi Wayne, thanks for your response.

    I created a new empty project using General, Empty Project; add new file, copy and paste text from C:\PETZOLD\CH02\hellowin.c.

    Empty Project with #include <windows.h> gets same result.

    Other projects: am a veteran of c/c++ since 89 using Borland to 3.1, Visual C++ 4 standard and Visual Studio 6.0 Enterprise. This is my first go at Visual Studio using .Net since a quick look at VB.net in 2003.

    Cannot get Stroustrup's Hello World program to run either (won't recognise cout) from <stream.h> or <iostream.h> (or istream, ostream etc.)) but have done Kernighan & Richie's both with and without precompiled headers. Adding #include <windows.h> to K&R's "Hello World" gets same error message.

    Have created new projects with and without precompiled headers as well as turning them off in Properties. No Change.

    I'm trying to just establish a baseline in this .net system. I'm running XP sp3.

    Regards,

    Richard.

     


    zrtf90
    Monday, September 5, 2011 9:30 AM
  • >I created a new empty project using General, Empty Project;
    > add new file, copy and paste text from
    >C:\PETZOLD\CH02\hellowin.c.

    If you do it that way, you will also have to set one or
    more settings in the project properties. e.g. -
    the SubSystem under the Linker/System properties
    will need to be set to /SUBSYSTEM:WINDOWS

    >Empty Project with #include <windows.h> gets same result.

    Sounds like you have a problem with your installation
    of the Win32 SDK.

    >Cannot get Stroustrup's Hello World program to run either
    >(won't recognise cout) from <stream.h> or <iostream.h>

    Headers in VC++ 2010 don't have the .h extension.
    Also, the streams and STL are in the std namespace.

    #include <iostream>
    using namespace std;

    - Wayne
    • Marked as answer by zrtf90 Monday, September 5, 2011 9:04 PM
    Monday, September 5, 2011 11:12 AM
  • Many thanks for your help, Wayne. I re-installed both the SDK and VS 2010 and have now successfully run code from Stroustrup, Petzold, and Kruglinski.

    Thanks again,

    Richard.

     


    zrtf90
    Monday, September 5, 2011 9:09 PM