Fatal Error C1010:


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!?!?!?



#include <iostream>

#include "classTime.h"
using namespace std;

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



#include <iostream>


using namespace std;

class classTime

      int x;
      int y;
      int z;      




//#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
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.

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.

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?
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.
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)

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!!
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

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.