Problem compiling a program

How do I compile my code   When I open a file, it won't let me debug or run the file.  And if I manage to get that, as soon as it runs, it just says: Press any key to continue... then it quits. 

Answer this question

Problem compiling a program

  • Colleen TechNot

    Thank you, that helped a lot.  But now I can't get #include <windows.h> to work, can you help.
  • picoSam

    In order to compile/debug your code you need to create a project. Look under File.New.Project and pick a project appropriate to your needs.

    What is your program doing If it is not doing very much then this is the behavior I would expect.

  • Sne

    I just got it to start compiling, but it is giving me an error:

    Compiling... Hello World.cpp c:\documents and settings\nick\my documents\visual studio 2005\projects\project1\
    project1\hello world.cpp(10) : fatal error C1010: unexpected end of file while
    looking for precompiled header. Did you forget to add '#include "stdafx.h"' to
    your source







    My program says:


    #include <iostream>

    using namespace std;

    int main()

    {

    cout << "Hello World!" << endl;

    return 0;

    }

    Please help!!!




  • Matthew Carter

    The error message is:
    fatal error C1083: Cannot open include file: 'windows.h': No such file or directory

  • fred99

    I am using Visual C++ Express Edition Beta.
  • Billy Hollis

    windows.h is part of the PSDK headers which is not installed with the VC 2005 Express SKU, you will need to install it separately.

    Check the below link for more details on how to proceed:
    http://lab.msdn.microsoft.com/express/visualc/usingpsdk/default.aspx

    Thanks,
      Ayman Shoukry
      VC++ Team



  • JeyKey

    Again: Help us in giving us the reason. At least we need an error message.

  • hakim ali dogar

    What SKU of VS2005 are you using

    Windows.h is part of the PSDK which is not installed with the Express version of VC++ 2005.

    Thanks,
      Ayman Shoukry
      VC++ Team

  • Ayres

    The easiest way to fix this is to just give the compiler what it wants and add:

    #include <stdafx.h>

    before the

    #include <iostream>

    The better fix is to disable support for pre-compiled headers in your project.

    You can do this as follows: in the Solution Explorer Window select your project; right-click and select Properties. On the properties dialog select Configuration Properties - C/C++ - Precompiled Headers. Select the "Create/Use Precompiled Header" property and change the dropdown to "Not Using Precompiled Headers".

    Another way to do this is to create a new Project and as part of the initialization steps make sure that the "Precompiled Header" option is not selected on the "Application Settings" screen.

  • Problem compiling a program