Skip to main content
GameDev.net gamedev.net
🔒 Locked

allready defined in ...

Started by Marty666 Jan 9, 2004 at 9:19 AM 3 replies 350+ views
Original Post
Marty666
Marty666
I have a header file for my program. If i use more then one cpp file that #include this header it says ''SOMETHING IN HEADER allready defined in THE OTHER CPP FILE'' to prevent this i usually type #ifndef HEADERNAME #defire HEADERNAME ... stuff in header #endif this doesn''t seem to work It''s been a while since i''ve been coding, so please help me with this stupid problem. Marty
_ /__ /|| | || MtY | ||_____|/Marty
Tree Penguin
Tree Penguin
Try putting the function definentions in a different cpp file (just add that one to your project).
Marty666
Marty666
I''m not sure what u mean? Should i rip all the function definitions out of the header and leave ''m in cpp files?

Is there another way? Because the functions, classes, etc. That aren''t really with the camera, but also not with the particle engine, etc (like texture loading and vector calculation) would be nice in the header...

I''ll do it ur way now, thanx Penguin!

Marty
_ /__ /|| | || MtY | ||_____|/Marty
Tree Penguin
Tree Penguin
declare you function in the header like this:

void Something();

and define them in a cpp file like this

void Something(){
};
Marty666
Marty666
Thanx!
That''s what i was looking for...


Marty
_ /__ /|| | || MtY | ||_____|/Marty

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.