class redefinition / header guards not working

I am using Visual C++ 2008 Express Edition

I have the following header class.h:

#ifndef GUARD_CLASS_H
#define GUARD_CLASS_H

#include <vector>
#include <string>

class myclass {
};

<member fns definitions>

#endif // GUARD_CLASS_H



I have two .cpp files that require this class, so I include "class.h" and get re-definition errors. How can I get around this problem?

You shouldn't define functions in headers, they are used for declarations
http://www.cplusplus.com/forum/articles/10627/
so i moved the member fns (and contructor(s)) into a separate source called class.cpp snd used the #include "class.h" at the top. and that did the trick. was this the right thing to do?
Yes
Thank you very much for your help!
Topic archived. No new replies allowed.