c++ - Getting error LNK2019: unresolved external symbol in vS@)!) that compiled fine in VC 6.0 -


i trying compile 14 year old c++ program vs2010 c++ compiler (dont ask why :( ). getting following error

error 10 error lnk2019: unresolved external symbol "public: __thiscall cconfiguration::cconfiguration(void)" (??0cconfiguration@@qae@xz) referenced in function "public: __thiscall cwhoisservice::cwhoisservice(void)" (??0cwhoisservice@@qae@xz)

i have cpp file cwhoisservice.cpp header cwhoisservice.h

cwhoisservice.h:

class cwhoisservice { public:     hresult initialize(const char * szservicename, refclsid pmetricsclsid);  cwhoisservice(); ~cwhoisservice(); hresult checkservice();  protected:      cconfiguration m_configuration;     protected:     bool           m_bstartedevenlog;     bool           m_bstartedconfiguration;  private:        //don't want standard constructor called }; 

cwhoisservice.cpp

#include "configurationlib.h" #include "cwhoisservice.h"  cwhoisservice::cwhoisservice():     m_bstartedevenlog(false),     m_bstartedconfiguration(false)  {  } hresult cwhoisservice::initialize(const char * szservicename, refclsid pmetricsclsid) {     hresult hr = s_ok;     //initialize configuration library     hr = m_configuration.initialize(version_company,version_system); 

the configurationlib.h file referenced in cpp file , included before cwhoisservice.h follows:

#ifndef _configuration_module #define _configuration_module  class cconfigurationbase { public:     cconfigurationbase() : m_binitialized(false) {};     virtual ~cconfigurationbase() {};      virtual hresult initialize(lpctstr szcompanyname, lpctstr szsystemname, lpctstr szglobalmachinename = null) = 0;      virtual bool isinitialized() { return m_binitialized;};  protected:     bool m_binitialized;            // true if object has been initialized };  class cconfiguration : public cconfigurationbase { public:     cconfiguration();     virtual ~cconfiguration();      // initialized values class.  must called first!     virtual hresult initialize(lpctstr szcompanyname, lpctstr szsystemname, lpctstr szglobalmachinename = null);  protected:     // function goes getting values registry     // other functions call 1     virtual hresult getvalue(hkey hkeybase, lpctstr szsectionname, lpctstr szvaluename, cstring * csvalue, dword * pdwvalue, dword dwtype);   }; // cconfiguration #endif // _configuration_module 

everything fine last time compiled around 10 years ago. not seem find configurationlib.h file. made sure part of project. if removed start of cpp file error: missing ';' before identifier 'm_configuration' ti see it. yet not appear able resolve class.

any assistance appreciated, have spend last 3 days on site , many others no progress.

i have spend last 3 days on site , many others no progress

it understand errors produced linker visual c++. next time see such error, shouldn't take 3 days figure out. know message looks garbled @ first, isn't if know for.

the trick choose parts of error makes sense, , skip on name-mangling (the gobbledy-gook looks linker swearing @ you). name-mangling useful, error, isn't important.

let's go through error:

unresolved external symbol "public: __thiscall cconfiguration::cconfiguration(void)"

the line above indicates function implementation cannot found linker. function cconfiguration::cconfiguration(void). in other words, 0-argument constructor cconfiguration cannot located linker.

next part of error message states:

referenced in function "public: __thiscall cwhoisservice::cwhoisservice(void)"

this function attempting call cconfiguration constructor. cwhoisservice::cwhoisservice(void) constructor. see here:

class cwhoisservice {   //... protected:      cconfiguration m_configuration;   }; 

you have member cconfiguration (m_configuration), when instantiate cwhoisservice, instantiating cconfiguration object.

the bottom line linker cannot find implementation cconfiguration constructor takes no arguments.

either

  1. did not add source module project contains implementation of cconfiguration constructor project, or
  2. the cconfiguration constructor in library , didn't specify library link in project, or
  3. you plain old didn't code cconfiguration constructor has no arguments, or
  4. some other unknown issue causes linker miss code contains implementation of constructor.

my guess more item 1. above.

also, has nothing header files. header file allows module compiled without error. not guarantee linker link successfully.

for example, can have module contains calls functions not exist, module compile successfully. however, @ link time, if function called doesn't exist, then error (as you're seeing now).


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -