?
Solved

fatal error C1010 (the usual fixes don't seem to work)

Posted on 2003-03-06
7
Medium Priority
?
537 Views
Last Modified: 2010-08-05
hello,

First a little background:
I've programmed console applications with C++ for about 3 years now. Two weeks ago, I decided to make a GUI for one of my applications. I'm using Visual C++ 6.0. My GUI is a Dialog based app (I used the CWizardDlg class to make it work like a wizard) There is a function assigned to one of the buttons on one of my propertyPages that is defined in a .cpp file -> NSGA2engine.cpp

I get the following error when I try to compile:
d:\gui_caoscag\nsga2engine.cpp(454) : fatal error C1010: unexpected end of file while looking for precompiled header directive

Since I'm new to Visual C++, I did some searching on the net for this problem to see if it was common. The 2 fixes I found were:
1. put #include "stdafx.h" at the top of my .cpp file

When I do this, I get the following errors:
d:\gui_caoscag\structcontrol.h(27) : error C2065: 'IDD_STRUCT_CONTROL' : undeclared identifier
d:\gui_caoscag\structcontrol.h(27) : error C2057: expected constant expression
d:\gui_caoscag\dcparameters.h(26) : error C2065: 'IDD_DC_PARAMETERS' : undeclared identifier
d:\gui_caoscag\dcparameters.h(26) : error C2057: expected constant expression
d:\gui_caoscag\dccontrolcurrent.h(26) : error C2065: 'IDD_DC_CONTROL_CURRENT' : undeclared identifier
d:\gui_caoscag\dccontrolcurrent.h(26) : error C2057: expected constant expression
d:\gui_caoscag\dcobjfuncdef.h(25) : error C2065: 'IDD_DC_OBJFUNC_DEF' : undeclared identifier
d:\gui_caoscag\dcobjfuncdef.h(25) : error C2057: expected constant expression
d:\gui_caoscag\dcgaparameters.h(26) : error C2065: 'IDD_DC_GA_PARAMETERS' : undeclared identifier
d:\gui_caoscag\dcgaparameters.h(26) : error C2057: expected constant expression
d:\gui_caoscag\dccurrentsimulation.h(27) : error C2065: 'IDD_DC_CURRENT_SIMULATION' : undeclared identifier
d:\gui_caoscag\dccurrentsimulation.h(27) : error C2057: expected constant expression
d:\gui_caoscag\dcsimulationresults.h(25) : error C2065: 'IDD_DC_SIMULATION_RESULTS' : undeclared identifier
d:\gui_caoscag\dcsimulationresults.h(25) : error C2057: expected constant expression
d:\gui_caoscag\dccontrolspeed.h(25) : error C2065: 'IDD_DC_CONTROL_SPEED' : undeclared identifier
d:\gui_caoscag\dccontrolspeed.h(25) : error C2057: expected constant expression
d:\gui_caoscag\dcobjfuncdefspeed.h(25) : error C2065: 'IDD_DC_OBJ_FUNC_DEF_SPEED' : undeclared identifier
d:\gui_caoscag\dcobjfuncdefspeed.h(25) : error C2057: expected constant expression
d:\gui_caoscag\dcgaparametersspeed.h(27) : error C2065: 'IDD_DC_GA_PARAMETERS_SPEED' : undeclared identifier
d:\gui_caoscag\dcgaparametersspeed.h(27) : error C2057: expected constant expression
d:\gui_caoscag\dcsimulationresultsspeed.h(25) : error C2065: 'IDD_DC_SIMULATION_RESULTS_SPEED' : undeclared identifier
d:\gui_caoscag\dcsimulationresultsspeed.h(25) : error C2057: expected constant expression
d:\gui_caoscag\dcspeedsimulation.h(26) : error C2065: 'IDD_DC_SPEED_SIMULATION' : undeclared identifier
d:\gui_caoscag\dcspeedsimulation.h(26) : error C2057: expected constant expression


The first set of errors seems to indicate that it no longer recognizes the identifiers for my Dialog resources.

So I decided to try the other fix that I found:
2. Go into the project settings for NSGA2engine.cpp and specify: not using precompiled headers

boy, this didn't work ;) I ended up with the following errors:
d:\gui_caoscag\structcontrol.h(14) : error C2504: 'CPropertyPage' : base class undefined
d:\gui_caoscag\structcontrol.h(18) : error C2143: syntax error : missing ';' before 'public'
d:\gui_caoscag\structcontrol.h(19) : error C2146: syntax error : missing ';' before identifier 'OnWizardNext'
d:\gui_caoscag\structcontrol.h(19) : error C2501: 'LRESULT' : missing storage-class or type specifiers
d:\gui_caoscag\structcontrol.h(20) : error C2146: syntax error : missing ';' before identifier 'OnSetActive'
d:\gui_caoscag\structcontrol.h(20) : error C2501: 'BOOL' : missing storage-class or type specifiers
d:\gui_caoscag\structcontrol.h(27) : error C2065: 'IDD_STRUCT_CONTROL' : undeclared identifier................

and many more errors (102 errors in total)....

So both of the fixes I found on the net didn't seem to do the trick. I'm guessing this is something real simple to fix but because of my lack of experience, I can't seem to figure it out.

Any help would greatly be appreciated.

I can post the code for my files if you think it would help.

Adrien
0
Comment
Question by:ADupuis
[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
 

Expert Comment

by:gotenks
ID: 8085787
i don't know if this could help, but did you define all these IDD_... stuffs already?

try to define them as :
#define IDD_STRUCT_CONTROL 1
#define IDD_DC_PARAMETERS 2
#define IDD_DC_CONTROL_CURRENT 3
...
and so on for the rest of the undeclared identifier
0
 

Author Comment

by:ADupuis
ID: 8085804
All of the Dialog boxes (IDD_STRUCT_CONTROL, ...) were already defined. They worked fine (no compile time errors) before I added the #include "stdafx.h" at the top of my .cpp file.
0
 
LVL 4

Expert Comment

by:Chase707
ID: 8085912
What are the contents of stdafx.h?

Are you including/referencing dialogs that use your IDD defs?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Expert Comment

by:gotenks
ID: 8086024
error C2065 :
Tips from Microsoft :
Make sure you are including any necessary header files if you have defined VC_EXTRALEAN, WIN32_LEAN_AND_MEAN, or WIN32_EXTRA_LEAN. Defining these symbols excludes some functionality (certain header files are excluded) from windows.h and afxv_w32.h (for MFC applications) to speed compiles. Search windows.h and afxv_w32.h for these symbols for the most up-to-date description of what is excluded.

or go to :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/html/c2065.asp

hope this will help, i have the same error like yours, the fatal C1010 : end of file...
but after i included the "stdafx.h" at the top of my .cpp file, it compiles fine.
0
 

Author Comment

by:ADupuis
ID: 8090041
To Chase707:
stdafx.h is the default precompiled header generated by the AppWizard. By default, all .cpp files are required to have it included at the top of the listing. Any commands before it is included will be ignored.

Hmmm, this is the only code that references anything from the GUI part of the code (this is found in my .cpp file):
pParent->m_DCCurrentSimulation.m_Sim_Progress.SetPos(100*(i+1)/numGens);

m_DCCurrentSimulation is an instance of a propertyPage derived class.
pParent is a pointer to a propertySheet derived class.

Perhaps I need to include the header of my propertySheet class in my .cpp file? or maybe the header of the main Dialog?

To qotenks:
Thanks for the suggestions, but I haven't defined any of those (VC_EXTRALEAN...).

0
 
LVL 4

Accepted Solution

by:
Chase707 earned 200 total points
ID: 8090329
>>stdafx.h is the default precompiled header generated by the AppWizard.
>>By default, all .cpp files are required to have it included at the top of the listing.
>>Any commands before it is included will be ignored.

True, I meant to ask if you had edited stdafx.h and had #include statements inside of it which included your dialogs.

I think your solution is that you need to make sure you #include "resource.h" in your file after the stdafx.h include.

Chase707
0
 

Author Comment

by:ADupuis
ID: 8104460
Yup, that did it. I had to add #include "my main dialog.h" to the file after the stdafx.h include..

thanks
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses
Course of the Month14 days, 20 hours left to enroll

770 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