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
KalluMamaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.