By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,190 Members | 839 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,190 IT Pros & Developers. It's quick & easy.

mistakes??

P: n/a
i am new to visual c++. recently i got a book and try to learn it step
by step. As i wish for a shorter way, i decided to download the code.

after i downloaded the code from the website as stated in the book, i
tried to compile it to see how's the output... but i get this error
message, which never appears if i insert the code manually..... why is
this happening??
i couldnt compile my work. where have it been wrong?

c:\documents and settings\student\local settings\temp\welcome.cpp(4) :
fatal error C1083: Cannot open include file: 'stdafx.h': No such file
or directory
Error executing cl.exe.
Jul 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
cherry wrote:
i am new to visual c++. recently i got a book and try to learn it step
by step. As i wish for a shorter way, i decided to download the code.

after i downloaded the code from the website as stated in the book, i
tried to compile it to see how's the output... but i get this error
message, which never appears if i insert the code manually..... why is
this happening??
i couldnt compile my work. where have it been wrong?

c:\documents and settings\student\local settings\temp\welcome.cpp(4) :
fatal error C1083: Cannot open include file: 'stdafx.h': No such file
or directory
Error executing cl.exe.


What's the code? Does it require any symbols defined in stdafx.h? Is
stdafx.h present on your system? Is it included as `#include "stdafx.h"'
or as `#include <stdafx.h>'? Does removing the #include directive make
the code compile correctly? What differences are there between the code
you downloaded and the code you entered yourself?

Where did you get "where have it been wrong?" from? I love it! But the
present tense might have been more appropriate.

Regards,
Buster

Jul 19 '05 #2

P: n/a

"John Harrison" <jo*************@hotmail.com> wrote in message
news:bgkqji$pij8f$1@ID-
c:\documents and settings\student\local settings\temp\welcome.cpp(4) :
fatal error C1083: Cannot open include file: 'stdafx.h': No such file
or directory
Error executing cl.exe.


Well its exactly as the error message says. The code you downloaded,
welcome.cpp, has this in it

#include "stdafx.h"

That tells the compiler to look for the file stdafx.h and compile that,
before going on to compile the rest of welcome.cpp.

Now why you don't have stdafx.h is not a question I can answer. Did you
forget to download it? Are you expected to create it yourself? Suggest you
go back to the website/book to find out.


That's an include statement that's added automatically to the main source
file in VC++ projects which are generated by its "wizards". The very first
thing I do is remove that from my project, and add whatever I need instead
manually.

-Howard

Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.