Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

"Unexpected end of file" ?

Posted on 2000-05-08
7
Medium Priority
?
463 Views
Last Modified: 2010-04-02
 On several of my Visual C++ 6 projects, I get an "Unexpected end of file" error when I attempt to compile my program.  I can't seem to figure out what this means, and it happens in several different programs- any idea what this is?
-Delion
0
Comment
Question by:Delion
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 225 total points
ID: 2789604
You'll have to add a

#include "stdafx.h"

at the beginning of your source files (and also make sure that there is such a file in the same directory, even if it's empty). VC++ uses this to create its precompiled headers. Either you'll have to turn off using precompiled headers (not recommended IMHO) in the project settings, or you'll have to live with this inconvenience....
0
 
LVL 1

Expert Comment

by:BSoeters
ID: 2790227
I slightly disagree with jkr...

It could well be that you include (the same) header file in all those projects.

If there's a syntax error somewhere in that header file, perhaps a missing semi-colon or something like that, or a missing closing brace, anything, it could be responsible for your "unexpected end of file".
0
 

Author Comment

by:Delion
ID: 2793656
Adjusted points from 50 to 75
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:Delion
ID: 2793657
 Ok- I added "stdafx.h" to all of my source files and that fixed all of the problems except one.  Here's the remaining one:
  I copied the source files from a DirectX SDK sample program, DDrawEx4, to a new project to see if I could figure out what each part of the sample program does by fiddling with it.  Essentially, I inserted the .cpp and .h files and bitmap into a new workspace.  
  Both the main source file (formerly called ddex4.cpp) and another source file in the project gave the "unexpected end of file" error, and "StdAfx.h" fixed the bug with ddex4.cpp.  However, if I add StdAfx.h to the other one it gives me new errors while linking during the compile instead:
"
Conquest.obj : error LNK2001: unresolved external symbol _DirectDrawCreateEx@16
and
"Conquest.obj : error LNK2001: unresolved external symbol _IID_IDirectDraw7"
Any idea what's causing this with this file?
-Delion
P.S.  Do you know how the DirectX sample program gets away without using "StdAfx.h"?
0
 
LVL 1

Expert Comment

by:BSoeters
ID: 2793896
Are you sure you're linking to ddraw.lib (or some similar file) ?
0
 
LVL 86

Expert Comment

by:jkr
ID: 2793913
>>Do you know how the DirectX sample
>>program gets away without
>>using "StdAfx.h"?

See 'Project->Settings->C++->Precompiled Headers'. There you can set through wich header the precompiled headers are handled. VC++ sets the default to 'stdafx.h' for generated projects.


>>unresolved external symbol
>>_DirectDrawCreateEx@16

Did you include ddraw.lib to your project?
0
 

Author Comment

by:Delion
ID: 2797356
 I have ddraw.lib in my vc98 include lib folder, if that's what you mean.  In either case, I'm going to start over and try working with directX by starting a new program from scratch instead of editing the existing sample, so I'll try that and post a new question if I have any troubles.  Thanks for the help with the stdafx.h thing- that fixed the rest of my problems.
-Delion
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question