Link to home
Start Free TrialLog in
Avatar of vaavoom
vaavoomFlag for United States of America

asked on

How do i properly use Header and implementation files?

General question for Visual C++. How do i include header files and other .cpp files (implementation files) in my program so that i dont have to keep it all in one file? what is the syntax, an example would be choosen as the solution right away. Thanks.
/*this is the stdafx.h header file that comes when you start a CLR console app in VC++ and how im trying to include another header file in my project*/
 
#pragma once
#include "header.h"

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Jaime Olivares
Jaime Olivares
Flag of Peru image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of vaavoom

ASKER

ok that helped actually but one thing im not clear on is:

in the header file i get errors that strings are not declared. The #include <string> does not seem to work in header files. Am i stuck using std::string?? Thanks
Avatar of vaavoom

ASKER

i tinkered around to solve it myself, thanks tho.
if you want more clarifications, ask Community Support to reopen the question and let me the chance to have a grade better than C.
Avatar of vaavoom

ASKER

Done.
when it comes back ill give you an A. Sorry im fresh and new here at EE but go ahead and give me and answer and also i was wondering:

does getting a bad grade affect some sort of track record you have? i dont mean to insult with it just trying to be fair.

Thanks again.
it does not affect my score, since I have a very high one, but it means "your answer was barely correct and/or poor of details, although you had the opportunity to do it better"

about the string header, it should work, but you will need to put in your code:

using namespace std;

usually it is done after the #include directives. Do you have it yet?
Avatar of vaavoom

ASKER

i do that makes sense... im now trying to figure out how to alter the grade given lol.
you have to ask to reopen the question, I will do this for you....