LNK2019

Hello,

I am getting these horrible Link errors. I have seen some information from other threads, but I am not able to reach those theads today. I get an error message when i do a search for LNK2019...

AuditLogDlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class ATL::CStringT > > __thiscall CEFTDBRowSet::GetError(void)" (__imp_ GetError@ $CEFTDBRowSet@VCEFTAuditLog@@@@QAE AV $CStringT@DV $StrTraitMFC_DLL@DV $ChTraitsCRT@D@ATL@@@@@ATL@@XZ) referenced in function "protected: void __thiscall CAuditLogDlg::OnRefresh(void)" ( OnRefresh@CAuditLogDlg@@IAEXXZ)
calendardlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall CEFTDBRowSet::~CEFTDBRowSet(void)" (__imp_ 1 $CEFTDBRowSet@VCEFTCalendar@@@@QAE@XZ) referenced in function "protected: virtual int __thiscall CCalendarDlg::OnInitDialog(void)" ( OnInitDialog@CCalendarDlg@@MAEHXZ)

Can you please assist.

Regards
Olivia


Answer this question

LNK2019

  • Marcus Widerberg

    Yes! There is no implementation for GetError!
    Look into you template there is no implemenation for the GetError function inside the header file for CEFTDBRowSet.

  • HendrikB

    Good Morning Ayman,

    Thank you for suggesting I use dumpbin. I have read up about it and I am sure it will help me trace my problem.

    Kind Regards
    Olivia

  • Alan Adams

    In the module AuditLogDlg there are references to functions like CEFTDBRowSet::GetError. There is no implementation for this.

    Are you using a foreign library Is there a LIB file not defined.
    What kind is this class CEFTDBRowSet Is it your class


  • Kraymer

    Consult your documentation! Big Smile

  • cvsan

    Hello Martin,

    Sorry I am still new at the C++ game. I am going to try and answer your questions as best I can.

    CEFTDBRowSet is my own class. I found this in a header file (CEFTDBRowSet.h)

    "typedef CEFTDBRowSet<CEFTAuditLog> CEFTAuditLogRowSet;". 

    The header file is an include file from the AuditLogDlg.cpp where it seems the error is coming from.

    If I remove the call:

    CString strMsg;

    strMsg.Format("Failed to load operator information from database.\n%s", 0);//rsOper.GetError());olivia

    AfxMessageBox(strMsg, MB_ICONERROR, MB_OK);

    The Link error disapears. So I am difficultly missing something when i Link.

    Regards
    Olivia


  • splashup

    As Martin suggested the documentation of your application should tell you what library is needed.

    If that is not possbile, you can use the tool dumpbin.exe (comes with VS) to dump the symbols in the libraries. 

    Thanks,
      Ayman Shoukry
      VC++ Team

  • ericsbox71

    It seams that the class is compiled with _EFTDB_DLL not set! So the C++ compiler searches the implementation outside the current module. The declspec(dllimport) is defined as you can see in the linker warnings. In this case there must be a library that contains this code. This library must be added to the linker options.



  • Sam09

    Hello Martin,

    The strange thing is that this compiles fine in Visual C++ 6.

    I found the following in EFTDBRowSet.h Is this what we are looking for

    #ifndef _EFTDBROWSET_H

    #define _EFTDBROWSET_H

    #pragma once

    #ifdef _EFTDB_DLL

    #define Export __declspec(dllexport)

    #else

    #define Export __declspec(dllimport)

    #endif

    #include <vector>

    #include <typeinfo.h>

    #include "EFTDb.h"

    #include "EFTDbQueries.h"

    //-----------------------------------------------------------------------------

    template <typename T>

    class Export CEFTDBRowSet

    {

    public:

    CEFTDBRowSet(CEFTDb& DB): m_DB(DB)

    {

    m_pRec = 0;

    m_iIndex = -1;

    m_iSize = 0;

    m_dwRowsetId = 0;

    }

    //---------------------------------------------------------------------------

    ~CEFTDBRowSet()

    {

    delete m_pRec;

    if(m_iSize!=0)

    {

    m_DB.ReleaseRowset(m_dwRowsetId);

    }

    }

    //---------------------------------------------------------------------------

    int Size()

    {

    return m_iSize;

    }

    //---------------------------------------------------------------------------

    CString GetError()

    {

    return m_DB.Error();

    }

    //--------------------------------


  • Sreenath H B

    How do I go about finding the library file that contains this code

    I've added all possible library files so far that I could think of. Does the sequence in which these files are added as additional dependencies on the Input page under Linker on the Property Page

  • LNK2019