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.
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.
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
Problem compiling a program
Shoshana
WhiteClaw48
fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
Petr Svoboda
#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.
Esteban404
FaytXenosus
nath
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
ThomasZecher
TimLiu
What is your program doing If it is not doing very much then this is the behavior I would expect.
Equisilus
Windows.h is part of the PSDK which is not installed with the Express version of VC++ 2005.
Thanks,
Ayman Shoukry
VC++ Team