Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Help with C++ Class

Hi my Friends
This my 1st thread in this usefull forum and i need help with Visual C++ program i wrote, i made a new project and i added a header file i wrote with my self which contain a class i wrote (voltage divider.h) also included the defination fille (Voltage divider.cpp) and added the include statement in the main header file of my project
(*dlg.h) and when i built the program i got an error message

"c:\Documents and Settings\KH.SOPHE\My Documents\Visual Studio Projects\My Classes\CVoltage Divider\Voltage divider.cpp(27): fatal error C1010: unexpected end of file while looking for precompiled header directive
"
and idon't know what's the problem please help
Regards :WAVE:
[726 byte] By [falcon eyes] at [2007-11-11 8:18:55]
# 1 Re: Help with C++ Class
Turn off precompiled headers. They are poorly done and a major source of problems.
jonnin at 2007-11-11 21:01:24 >
# 2 Re: Help with C++ Class
Thanks for the answer,but how can i turn it off by the way i'm using
MS Visual studio 2003
falcon eyes at 2007-11-11 21:02:35 >
# 3 Re: Help with C++ Class
right click your project, pull up the settings, and find it and choose "not using precompiled headers". By the way, the project settings are very important and you should become familiar with all of them.
jonnin at 2007-11-11 21:03:34 >
# 4 Re: Help with C++ Class
Hi Jonnin Thank u very much i do it and it work fine :) :WAVE:
falcon eyes at 2007-11-11 21:04:35 >
# 5 Re: Help with C++ Class
Pls Jonnion if u have any article or document about the project setting ca u send it to the forum for all pepoles
Regards
falcon eyes at 2007-11-11 21:05:33 >
# 6 Re: Help with C++ Class
They are pretty much self explained -- each page has a help associated with it that explains what each one does with reasonable detail. There are many pages and things you need to learn to do (drop precompiled headers, increase the stack size if your program has a lot of static data, choose any suitable for inline instead of keyword selected, add include paths, define any compiler switch variables, and more). This is extremely important to understand once you get beyond school and into production code.
jonnin at 2007-11-11 21:06:33 >
# 7 Re: Help with C++ Class
If you had selected the MFC supported environment then at the top of any .CPP File you must include Stdafx.h.

reply if you get your answer.
PoojaPatel at 2007-11-11 21:07:31 >
# 8 Re: Help with C++ Class
--If you had selected the MFC supported environment then at the top of any .CPP File you must include Stdafx.h.

No, this is incorrect. You can just include windows.h instead (this is what stdafx does, but stdafx has junk in it that can create problems). Also, only files that USE mfc stuff require this, a normal class file or whatever is fine when added to a mfc project. When in doubt, just comment out as much of stdafx as you can until you determine how much of it you NEED.
jonnin at 2007-11-11 21:08:40 >