//portl.cpp
namespace FAWN {
namespace Sys{
class PortListner {
....
Connecter::ConPtr _cur_con; - the main problem is here
…
//con.cpp
namespace FAWN {
namespace Sys {
class Connecter {
.....
public:
typedef boost::shared_ptr<Connecter> ConPtr;
…
Moreover, portl.cpp file is included into some other “main” sourse file. And this “other-main” file includes con.cpp too. So if I include con.cpp to portl.cpp – I define Connecter twice (in portl and in main). If I do not include it, compilator doesn’t know what Connecter::ConPtr (or FAWN::sys::Connecter::ConPtr) means and try to use it as defenition of method.
Put the
class Connecter(which you should probably rename toConnector) into a header file (.hinstead of.cpp) and add include guards into the file. That is, at the beginning of yourcon.hfile, add linesand at the very end, add the line
This way, even if you
#includecon.htwice, the second time it will not get read because the symbolCON_H_INCLUDEDhas been defined on the first time so the#ifndef-#endifpair hides the content.This is the common way in C++: put class declarations in
.hfiles that get#included in.cppfiles that then actually define the functions.