Boost logo

Boost Users :

Subject: [Boost-users] General C++: Unresolved reference to operator overloads
From: Etienne Philip Pretorius (icewolfhunter_at_[hidden])
Date: 2010-06-19 11:35:15


Hello List,

I please be kind, as I know this is not boost related.

Inside the header file I define the following:

     /* Operator + */
     std::vector<std::uint8_t>
     operator+(
         const std::vector<std::uint8_t>& x,
         const std::vector<std::uint8_t>& y
     );
     /* Operator - */
     std::vector<std::uint8_t>
     operator-(
         const std::vector<std::uint8_t>& x,
         const std::vector<std::uint8_t>& y
     );

And then inside the implementation CPP file I do the following:

/* Operator + */
std::vector<std::uint8_t>
operator+(
     const std::vector<std::uint8_t>& x,
     const std::vector<std::uint8_t>& y
) {
  *obmitted for brievity*
};
/* Operator - */
std::vector<std::uint8_t>
operator-(
     const std::vector<std::uint8_t>& x,
     const std::vector<std::uint8_t>& y
) {
  *obmitted for brievity*
};

Yet when I compile I keep on getting :

undefined reference to `operator+(std::vector<unsigned char,
std::allocator<unsigned char> > const&, std::vector<unsigned char,
std::allocator<unsigned char> > const&)'

Is there something that I am missing?

Kind Regards,
Etienne Pretorius


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net