• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 320
  • Last Modified:

Fatal Error C1010:

Hi,

I'm just starting out with classes and i was trying to make one but kept getting this error!! "Unxpected end of file while looking for precomplied header directive. What do you think the error is...what am i doing wrong!?!?!?

=================================

//classTime.cpp

#include <iostream>

#include "classTime.h"
using namespace std;

classTime::Time()            // default constructor
{
      x  = 0;
      y  = 0;
      z  = 0;
}

=================================

//classTime.h

#include <iostream>

#ifndef CLASSTIME_H
#define CLASSTIME_H

using namespace std;

class classTime
{
public:
      Time();

private:
      int x;
      int y;
      int z;      
};

#endif

=================================

//TestDriver.cpp


// INCLUDES
//#include "stdafx.h"
#include <conio.h>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <cstdlib>      
//#include "windows.h"

#include "classTime.h"

using namespace std;

int main()
{
      return 0;
} // main
0
KalluMama
Asked:
KalluMama
  • 2
  • 2
1 Solution
 
udo_borkowskiCommented:
I am guessing that you are using Visual Studio.

Have a look at  "Project>Settings...". The dialog "Project Settings" pops up.

Select the "C/C++" tab and choose "Precompiled Headers" in the "Category" field.

Then check the option "Not using precompiled headers" in the page that becomes visible.

Press "OK" and the error messages should go away.
0
 
KalluMamaAuthor Commented:
OK, once I do that...I will need to insert #include "stdafx.h" at the top of each file?
0
 
jkrCommented:
If you set the project to "Not using precompiled headers", you will not have to, but that will cause a speed degradation for not-so-small projects. I'd rather recomend to create an empty file "stdafx.h" and include that one at the top of each source file.
0
 
udo_borkowskiCommented:
jkr is right that not using precompiled headers *may* cause a speed degradation for not-so-small projects.

On the other hand this heavily depends on the overall structure of your system. Since only one "precompiled" header file can be used one tends to "put every (runtime) include file" into this precompiled header file, making the generated precompile quite large. For files that are not using much "external" references this will be a drawback. Also a lot depends on the environment you are using. With a good hard disk and on a "modern" OS (like WinXP) many of the advantage of the precompiled header file go away (e.g. because of file caching etc.)

(BTW: using an empty "stdafx.h" will not bring any speed improvements)



0
 
KalluMamaAuthor Commented:
i'm just using real small classes to learn more about em so speed will not be an issue for me...right now its only a question of getting the damn thing straight in my head!!
0

Featured Post

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.

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