Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 560
  • Last Modified:

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

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
ADupuis
Asked:
ADupuis
  • 3
  • 2
  • 2
1 Solution
 
gotenksCommented:
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
 
ADupuisAuthor Commented:
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
 
Chase707Commented:
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.

 
gotenksCommented:
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
 
ADupuisAuthor Commented:
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
 
Chase707Commented:
>>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
 
ADupuisAuthor Commented:
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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now