eclipse - Unexpected LNK 2019 in C++ class -


i'm encountering following linker issue when try build project.

i've had through other posts here , far can see, externals i'm using members of standard (and identified std::), or primitives. there obvious i'm missing here?

building using eclipse c++ (mars) on win 7 professional 64bit using internal eclipse builder.

log:

link /debug /nologo /out:sad-snoop.exe "src\bytescanner.obj" "src\enctype.obj" "src\sad-snoop.obj" "src\searchhits.obj"

searchhits.obj : error lnk2019: unresolved external symbol "public: long __thiscall searchhits::gethitaddress(unsigned int)" (gethitaddress@searchhits@@qaeji@z) referenced in function "public: bool __thiscall searchhits::merge(class searchhits)" (?merge@searchhits@@qae_nv1@@z)

sad-snoop.exe : fatal error lnk1120: 1 unresolved externals

14:28:44 build finished (took 909ms)

header:

/*  * searchhits.h  *  *  created on: 30 jun 2015  *      author: nick boyd  */  #ifndef searchhits_h_ #define searchhits_h_  #include <iostream> #include <string> #include <vector>  class searchhits { public:     searchhits();     ~searchhits();     bool addhit(std::string content, long address);     unsigned int counthits();     std::string gethit(unsigned int hitnumber);     long gethitaddress(unsigned int hitnumber);     bool merge(searchhits hits); private:     std::vector<std::string> hits;     std::vector<long> hitaddresses; };  #endif /* searchhits_h_ */ 

class:

/*  * searchhits.cpp  *  *  created on: 30 jun 2015  *      author: nick boyd  */  #include "searchhits.h" #include <string> #include <iostream> #include <vector>  std::vector<std::string> hitcontents; std::vector<long> hitaddresses;  searchhits::searchhits() { }  searchhits::~searchhits() {     hitcontents.clear();     hitaddresses.clear(); }  bool searchhits::addhit(std::string hitcontent, long address) {     hitcontents.push_back(hitcontent);     hitaddresses.push_back(address);     return ((hitcontents.back() == hitcontent)             && (hitaddresses.back() == address)); }  unsigned int searchhits::counthits() {     return hitcontents.size(); }  std::string searchhits::gethit(unsigned int hitnumber) {     if (hitnumber < hitcontents.size()) {         return hitcontents[hitnumber];     } else {         std::cout << "error in function [searchhits::gethit()]" << std::endl                 << "parameter [hitnumber] out of bounds: "                 << hitnumber + " upper limit: " << hitcontents.size()                 << std::endl;         throw new std::invalid_argument(                 "error in function [searchhits::gethit()] parameter [hitnumber] out of bounds: "                 + std::to_string(hitnumber));     } }  long gethitaddress(unsigned int hitnumber) {     if (hitnumber < hitcontents.size()) {         return hitaddresses[hitnumber];     } else {         std::cout << "error in function [searchhits::gethitaddress()]"                 << std::endl << "parameter [hitnumber] out of bounds: "                 << hitnumber << " upper limit: " << hitcontents.size()                 << std::endl;         throw new std::invalid_argument(                 "error in function [searchhits::gethitaddress()] parameter [hitnumber] out of bounds: "                 + std::to_string(hitnumber));     } }  bool searchhits::merge(searchhits hits) {     bool overallresult = true;     unsigned int = 0;      while ((i < hits.counthits()) && overallresult) {         bool tempresult = false;         unsigned char attemptnum = 1;         while ((tempresult == false) && (attemptnum++ <= 5)) {             tempresult = this->addhit(hits.gethit(i),hits.gethitaddress(i));         }         overallresult = (overallresult && tempresult);         ++i;     }     if (overallresult) {         hits.~searchhits();     }     return overallresult; } 

change

long gethitaddress(unsigned int hitnumber) 

to

long searchhits::gethitaddress(unsigned int hitnumber) 

Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -