mistakes??

C

cherry

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.
 
B

Buster Copley

cherry said:
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
 
H

Howard

John Harrison said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top