Unresolved external symbol

Sandeep Kurhade 1 Reputation point
2022-12-02T12:22:06.577+00:00

I am migrating my code from VC6 to VS2010
Please help me to get rid of from below error.

LogisticsD.lib(ADODatabase.obj) : error LNK2001: unresolved external symbol "public: __thiscall CString::~CString(void)" (??1CString@@QAE@XZ)

7>LogisticsD.lib(ADODatabase.obj) : error LNK2019: unresolved external symbol "public: __thiscall CString::CString(char const *)" (??0CString@@QAE@PBD@Z) referenced in function "public: __thiscall ADOConnection::ADOConnection(char const *)" (??0ADOConnection@@QAE@PBD@Z)
7>LogisticsD.lib(ADODatabase.obj) : error LNK2019: unresolved external symbol "public: void __cdecl CString::Format(char const *,...)" (?Format@CString@@QAAXPBDZZ) referenced in function "public: __thiscall ADOConnection::ADOConnection(char const *)" (??0ADOConnection@@QAE@PBD@Z)
7>LogisticsD.lib(ADODatabase.obj) : error LNK2019: unresolved external symbol "public: __thiscall CString::CString(void)" (??0CString@@QAE@XZ) referenced in function "public: __thiscall ADOConnection::ADOConnection(char const *)" (??0ADOConnection@@QAE@PBD@Z)
7>LogisticsD.lib(ADODatabase.obj) : error LNK2019: unresolved external symbol "unsigned short * __stdcall _com_util::ConvertStringToBSTR(char const *)" (?ConvertStringToBSTR@_com_util@@YGPAGPBD@Z) referenced in function "public: __thiscall _bstr_t::_bstr_t(char const *)" (??0_bstr_t@@QAE@PBD@Z)
7>LogisticsD.lib(ADODatabase.obj) : error LNK2019: unresolved external symbol "char * __stdcall _com_util::ConvertBSTRToString(unsigned short *)" (?ConvertBSTRToString@_com_util@@YGPADPAG@Z) referenced in function "public: char const * __thiscall _bstr_t::Data_t::GetString(void)const " (?GetString@alrt _t@_bstr_t@@QBEPBDXZ)
7>LogisticsD.lib(ADODatabase.obj) : error LNK2019: unresolved external symbol "public: __thiscall CString::CString(class CString const &)" (??0CString@@QAE@ABV0@@Z) referenced in function "public: virtual class CString __thiscall ADOException::GetErrorMessage(void)const " (?GetErrorMessage@ADOException@@ube ?AVCString@@XZ)
7>LogisticsD.lib(ADODatabase.obj) : error LNK2019: unresolved external symbol "public: class CString & __thiscall CMapStringToString::operator[](char const *)" (??ACMapStringToString@@QAEAAVCString@@PBD@Z) referenced in function "public: virtual void __thiscall ADOCommand::SetParameter(char const *,char const *)" (?SetParameter@ADOCommand@@UAEXPBD0@Z)
7>LogisticsD.lib(ADODatabase.obj) : error LNK2019: unresolved external symbol "public: class CString const & __thiscall CString::operator=(class CString const &)" (??4CString@@QAEABV0@ABV0@@Z) referenced in function "public: virtual void __thiscall ADOCommand::SetParameter(char const *,char const *)" (?SetParameter@ADOCommand@@UAEXPBD0@Z)
7>LogisticsD.lib(ADODatabase.obj) : error LNK2019: unresolved external symbol "class CString __stdcall operator+(class CString const &,char const *)" (??H@YG?AVCString@@ABV0@PBD@Z) referenced in function "public: virtual void __thiscall ADOCommand::SetParameter(char const *,char const *)" (?SetParameter@ADOCommand@@UAEXPBD0@Z)
7>LogisticsD.lib(ADODatabase.obj) : error LNK2019: unresolved external symbol "class CString __stdcall operator+(char const *,class CString const &)" (??H@YG?AVCString@@PBDABV0@@Z) referenced in function "public: virtual void __thiscall ADOCommand::SetParameter(char const *,char const *)" (?SetParameter@ADOCommand@@UAEXPBD0@Z)
7>LogisticsD.lib(ADODatabase.obj) : error LNK2019: unresolved external symbol "public: int __thiscall CString::Replace(char const *,char const *)" (?Replace@CString@@QAEHPBD0@Z) referenced in function "public: virtual void __thiscall ADOCommand::SetParameter(char const *,char const *)" (?SetParameter@ADOCommand@@UAEXPBD0@Z)
7>LogisticsD.lib(ADODatabase.obj) : error LNK2019: unresolved external symbol "public: class CString __thiscall COleDateTime::Format(char const *)const " (?Format@COleDateTime@@QBE?AVCString@@PBD@Z) referenced in function "public: virtual void __thiscall ADOCommand::SetParameter(char const *,class COleDateTime)" (?SetParameter@ADOCommand@@UAEXPBDVCOleDateTime@@@Z)
7>LogisticsD.lib(ADODatabase.obj) : error LNK2019: unresolved external symbol "public: void __thiscall CMapStringToString::GetNextAssoc(struct __POSITION * &,class CString &,class CString &)const " (?GetNextAssoc@CMapStringToString@@QBEXAAPAU__POSITION@@AAVCString@@1@Z) referenced in function "private: class CString __thiscall ADOCommand::ReplaceParameters(void)" (?ReplaceParameters@ADOCommand@@0xAAE ?AVCString@@XZ)
7>LogisticsD.lib(ADODatabase.obj) : error LNK2019: unresolved external symbol "public: class CString const & __thiscall CString::operator=(char const *)" (??4CString@@QAEABV0@PBD@Z) referenced in function "public: virtual class CString __thiscall ADOCommand::ExecuteScalar(void)" (?ExecuteScalar@ADOCommand@@UAE ?AVCString@@XZ)
7>LogisticsD.lib(ADODatabase.obj) : error LNK2019: unresolved external symbol "public: class COleDateTime const & __thiscall COleDateTime::operator=(struct tagVARIANT const &)" (??4COleDateTime@@QAEABV0@ABUtagVARIANT@@@Z) referenced in function "public: virtual class COleDateTime __thiscall ADOCommandEx::GetParameterDateTime(char const *)" (?GetParameterDateTime@ADOCommandEx@@UAE ?AVCOleDateTime@@PBD@Z)
7>LogisticsD.lib(ADODatabase.obj) : error LNK2019: unresolved external symbol "public: int __thiscall COleDateTime::ParseDateTime(char const *,unsigned long,unsigned long)" (?ParseDateTime@COleDateTime@@QAEHPBDKK@Z) referenced in function "public: virtual class COleDateTime __thiscall ADOReader::GetDateTime(int)" (?GetDateTime@ADOReader@@UAE ?AVCOleDateTime@@H@Z)
7>LogisticsD.lib(ADODatabase.obj) : error LNK2019: unresolved external symbol "public: void __thiscall CString::ReleaseBuffer(int)" (?ReleaseBuffer@CString@@QAEXH@Z) referenced in function "public: virtual void __thiscall ADOCommandEx::AddParameter(char const *,class _variant_t &,enum DBDataType,enum DBParamDirection)" (?AddParameter@ADOCommandEx@@UAEXPBDAAV_variant_t@@W4DBDataType@@W4DBParamDirection@@@Z)
7>LogisticsD.lib(ADODatabase.obj) : error LNK2019: unresolved external symbol "public: char * __thiscall CString::GetBuffer(int)" (?GetBuffer@CString@@QAEPADH@Z) referenced in function "public: virtual void __thiscall ADOCommandEx::AddParameter(char const *,class _variant_t &,enum DBDataType,enum DBParamDirection)" (?AddParameter@ADOCommandEx@@UAEXPBDAAV_variant_t@@W4DBDataType@@W4DBParamDirection@@@Z)

Developer technologies | C++
Developer technologies | C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
{count} votes

2 answers

Sort by: Most helpful
  1. WayneAKing 4,931 Reputation points
    2022-12-03T04:54:45.247+00:00

    Most/all of the errors appear to be related to CString,
    so the MFC library with the CString class can't be
    found.

    What edition of VS/VC 2010 are you using? Express? Pro?
    2010 Express did not include MFC.

    I assume that the edition you have installed supports MFC,
    as it seems your compiles were error-free as the build
    has reached the link step.

    In the Project Properties does the linker settings pane
    have an option for "Use of MFC"? If it does, to what is
    it set?

    • Wayne
    0 comments No comments

  2. Sheng Jiang 蒋晟 206 Reputation points
    2022-12-03T16:14:44.923+00:00

    you cannot link libs from different MFC versions. Or cross link between debug and release.

    MFC's CString became a template in VC7 so there is nothing to link to. You have some old libs that need to recompiled using the same MFC version you are using.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.