Xcode C++ "Use of undeclared identifier" error with another class -
i've done reading on site here undeclared identifier errors in xcode , c++. seems comes small typo somewhere in code, can't figure out life of me why i'm getting error (also please note beginner in c++, may making dumb mistake).
i'm writing own library artificial neural nets, , when try compile 'connection' class bunch of "use of undeclared identifier 'node'" error on every line in connection.h file has node class somewhere in it. classes node , connection in same namespace, , both cpp files implemented functions declared in header files. here header files both classes:
connection.h (where i'm having problems):
#include <iostream> #include <tuple> #include <boost/shared_ptr.hpp> #include "node.h" namespace ann{ class connection{ public: connection(); connection(boost::shared_ptr<node> innode, boost::shared_ptr<node> outnode, float weight, int connid); ~connection(); virtual boost::shared_ptr<node> getinputnode(); virtual boost::shared_ptr<node> getoutputnode(); virtual void setinputnode(boost::shared_ptr<node> innode); virtual void setoutputnode(boost::shared_ptr<node> outnode); virtual float getconnectionweight(); virtual void setconnectionweight(float weight); virtual int getconnectionid(); virtual void setconnectionid(int id); protected: std::tuple<boost::shared_ptr<node> , boost::shared_ptr<node> , float> connection; int connectionid; private: }; }
in addition, i'm getting other errors in line have protected connection variable declared. i'm getting "parse issue : expected type" , "parse issue : expected member name or ';' after declaration specifiers".
here node.h:
#include <iostream> #include <vector> #include <boost/shared_ptr.hpp> #include "activationfunction.h" #include "connection.h" namespace ann{ class node{ public: enum{ input = 0, hidden = 1, output = 2 }kannnodetypes; node(int num, int nodetype); ~node(); virtual void addoutputconnection(boost::shared_ptr<connection> outputconnection); virtual void activatenode(activationfunction* activationobject); virtual void addinputsignalfromincomingnode(float inputsignal, float connectionweight); virtual int getnodetype(); virtual int getnodenum(); virtual void loadinputassensorinput(float input); virtual bool isactivated(); virtual bool isallinputsreceived(); virtual float getlatestoutput(); virtual void resetnode(); virtual void sendoutputtooutputnodes(); virtual void setnumberofinputconnections(int nc); virtual int getnumberofinputconnections(); protected: int nodenum; int nodetype; int ninputconnections; int inputconnectioncount; float latestoutput; bool activated; float inputsignal; bool allinputsreceived; std::vector<float> outputweights; std::vector<boost::shared_ptr<node>> outputconnections; private: }; }
Comments
Post a Comment