• Advertisement

Archived

This topic is now archived and is closed to further replies.

VC++ problem

This topic is 6451 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Someone please help - I have just started using VC++ for the first time, and I am having trouble getting my program to compile. The project is a Win 32 console application, and the code is as follows: #include iostream.h int main() { cout << "Hello World\n"; return 0; } When I try to compile this, I get an error: "fatal error C1010: unexpected end of file while looking for precompiled header directive." I don't know what could be wrong - could someone please help me out. Thanks. Edited by - Mister Stewart on 6/24/00 11:37:43 AM

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Try going on the menu under "Project\Settings"
Select the "C\C++" tab, and "Category: Precomplied headers". Select "Not using precompiled headers". That should do it!

Share this post


Link to post
Share on other sites
are you actually including the I/O header file instead of just typing "header?"

You may need to include something like "#INCLUDE

try that

SPAR1

Share this post


Link to post
Share on other sites
instead of typing "#include", try typing "#include ".
that should solve the problem. I''m also assuming that you are building a simple console application and not a win32 application, correct?

Share this post


Link to post
Share on other sites
Don''t you need to specify a filename after #include like:

#include

Share this post


Link to post
Share on other sites
Thanks for the swift replies! Okay, Anonymous, I'll give it a try.

In response to SPAR, that line should have read
#include iostream.h

In response to TheGriz42, yes I am trying to create a console app - does it matter? I tried to create the other type of Win32 app, but I had the same problem.



Edited by - Mister Stewart on June 24, 2000 12:36:23 PM

Share this post


Link to post
Share on other sites
I understand that you are making a console application.....
But if you think that code might work in a Win32 application.......you have got a lot of Win32 programming to learn.....ALOT

"Now go away or I shall taunt you a second time"
- Monty Python and the Holy Grail
themGames Productions

Share this post


Link to post
Share on other sites
Okay,

I did type inlcude iostream but something with the HTML here blotted it out!
Same with some other posts, oh well

anyway i think we all get the point here

Share this post


Link to post
Share on other sites
Putting a semicolon at the end of main() should generate an error.
The problem is you've specified (or used a wizard that specifies) you want to use "precompiled headers".
Basically, it's looking for the line #include "stdafx.h" but can't find it. You also have to make sure this file exists, like so.........
First, try doing #include "stdafx.h". If this doesn't work, or you want to do it properly, create a new console application using:

1. Load VC++
2. Menu: File, New...
3. Select "Win32 Console Application"
4. Enter directory / project name and click OK
5. Select "A Hello, World Application."
6. Click finish (click OK on the pop-up window)
7. Switch to the main file (Under the FileView tab, under your Project Name, under source files -> not stdafx.cpp)
8. There you are - just keep the first #include "stdafx.h" line and code away

Sorry if I sound patronising, I don't mean to

Hope this helps...


P.S. to do the < and > symbols, use "& l t ;" and "& g t ;" (without the spaces)


Edited by - kieren_j on June 24, 2000 2:42:55 PM

Share this post


Link to post
Share on other sites
Everyone, thanks a lot(everyone except that smart ass Monty Python fan) - I managed to figure it out. Up till now I have used Borland compilers where they don''t need projects.

Thanks again people.

Mister Stewart.

Share this post


Link to post
Share on other sites

  • Advertisement