dimanche 13 août 2017

C++ Mulitply Defined consructor error message seems wrong

gcc version 5.4.0 (GCC)

> g++ -std=c++11

During a build I get a multiply defined error message for a class constructor. When I delete the constructor, I get an undefined symbol error message. I'm stumped.

NodeClass::NodeClass( ... ) is marked as

Error Message

build/Debug/Cygwin64-Windows/nodeClass.o: In function `__gnu_cxx::new_allocator<std::string*>::~new_allocator()':
/c/home/skidmarks/Projects/MPHASH/mphash/NodeClass.cpp:36: multiple definition of `NodeClass::NodeClass(std::vector<std::string*, std::allocator<std::string*> >&)'

build/Debug/Cygwin64-Windows/NodeClass.o:/c/home/skidmarks/Projects/MPHASH/mphash/NodeClass.cpp:36: first defined here

=============================================================== Header file

# include <vector>
   # include <gslip/SlipPointer.h>

   class NodeClass : public SlipPointer {
       private:
          vector<string*> vec;
       public:
          NodeClass(vector<string*>& vec);
          virtual ~NodeClass() { };
       private:
          NodeClass(const NodeClass& orig) { };
    };

Source Code

# include <vector>
# include "NodeClass.h"

using namespace std;
using namespace slip;

   NodeClass::NodeClass(vector<string*>& vec) : SlipPointer(new string("Cluster Node"))
                                              , vec(vec) {
   }

Aucun commentaire:

Enregistrer un commentaire