\Practice.cpp(1) : fatal error C1083: Cannot open include file: 'stdafx.h': No such file or directory
A long time ago someone told me to go into the properties of the project and change the default to CLR support. I did this time but it doesn't seem to build. Can someone tell me what to do Here is my code:
#include
"stdafx.h"#using
<mscorlib.dll>using
namespace System;
int
_tmain(){
int Number = 5, Number2 = 0, Number3 = 7; int sum = 0;Console::WriteLine(
"hello world.");Console::WriteLine(
"Please enter a number.");Number2 = Int32::Parse(Console::ReadLine());
sum = Number + Number2;
Console::WriteLine(
"The sum is: {0} {1}", sum, Number3); return 0;}

Getting Error - Regarding stdafx.h
FrankHsu
#include "stdafx.h"
#include <mscorlib.dll>
using namespace System;
int _tmain()
{
Consol::WriteLine("Hello World!!");
return 0;
}
Piyush K. Singh
http://msdn.microsoft.com/library/default.asp url=/library/en-us/vccore/html/vcurfprecompiledheaderfiles.asp
hope it's useful
Try linux. The folk are much more helpful.
http://www.debian.org
Yuko
THis is driving me crazy because I had this same problem with the 2002 version, and I can't program because of this.
I tried what you said but the 2005 beta already has the precompiled header set to "OFF", and Ctrl N brings up the ADD NEW ITEM DIALOG BOX.
Also what I did was in my first project titled "John" I looked in the folder and found several more files that pre-loaded into the project: here are the files that preloaded into that project that WILL NOT load into the other ones:
stdafx.h (source file)
stdafx C/C++ (header file)
Readme.txt (explaining the folders contents
what I did was copied the stdafx source and header files into the projects that wouldn't work. It actually worked, so what I'm trying to figure out is how to program VS to pre-load the stdafx source and header file into each project. Any ideas
**updated**
I found that in order for it to work I have to choose CLR Console "Empty Project."
Phoenix5096
ceng2000
RunerBill
Probably making an empty file called stadfx.h would do the trick to get your compiler to stop complaining.
Mezoni
The "\n thing" was an entirely different issue that was piggybacking on that thread--you can ignore that.
Brian
rickyrock
RNL Manager
MJD
But then, as I have you would probably run into all kinds of other problems.
Do project=>properities and then select the C++ folder
This opens up a dialog with the project settings. Your objective is to disable the precompiler.
The top row in the dialog at the right (in VS.net 2003) is the one you are interested in. Click on the row to open a drop down box and select no precompiler.
Then delete the include stdafx.h file and you're away. Let me know if this works for you.
It seems that stdafx.h is a way of gathering the includes that your project needs and precompiling them. I've had nothing but trouble with it and found documentation lacking on the subject. I would just turn it off until you think you need it.
One Eyed Phil
Adding the files themselves is not enough to enable a project to use precompiled headers. I'm also not sure what you mean by "preloading" projects with precompiled headers. I've helped another person on this issue by giving some basis for what pch files are and how they're created. Perhaps reading my previous post will help demystify the issues.
http://forums.microsoft.com/msdn/ShowPost.aspx PostID=115695
invalid display name 3
Alternatively, if you wich to keep the precompiled headers turned on you need to go into the stdafx.h file and under where it says ~TODO you need to include the headers which are caussing errors to be thrown. Then everythingworks great. I had exactly the same problem.
Perry Ismangil
The "Precompiled Header" is already checked, should I uncheck it
Anonymous/
I just realized something, I just noticed that I kept pressing "Empty Project." Does this have something to do with all these errors Because with I left it unchecked, this code automatically came up:
// Hello.cpp : Defines the entry point for the console application.
#include
"stdafx.h"int
_tmain(int argc, _TCHAR* argv[]){
return 0;}
What is that is that what I"m supposed to get because I typing #include "stdafx.h" manually. what is
int argc, _TCHAR* argv[]
Also, I just tried not using the Precompiled Headers, and it keeps giving me the same error message
fatal error C1083: Cannot open include file: 'mscorlib.dll': No such file or directory
What am I doing wrong