none
Need help on link error lnk2005 RRS feed

  • Question

  • Hi everyone,

    I tried to use some functions in a dll file, name "clserala.dll", which is put  under my project folder.  I wrote codes to import those function in file "MyProjectView.h" like follows:

    ////////////////////////////////////////////////////
    //inside MyProjectView.h
    extern "C"
    {
    int  (*clSerialInit)(unsigned long serialIndex,    void** serialRefPtr) = 0;
    ...      //other functions
    }

    class::CMyProjectVew::public CFormView
    {
    ...
    }
    ////////////////////////////////////////////////////

    It showed link error:
    Linking...
    MyProjectView.obj : error LNK2005: "int (__cdecl* clSerialInit)(unsigned long,void * *)" (?clSerialInit@@3P6AHKPAPAX@ZA) already defined in MyProject.obj
    ...           //more errors on other functions in this dll

    Please help me.

    Best regards,
    Fangming
    Monday, July 21, 2008 3:51 PM

Answers

  • Your DLL should come with a small static import libraray, "clserala.lib", which you should link to your project.


    David Wilkinson | Visual C++ MVP
    • Marked as answer by Yan-Fei Wei Friday, July 25, 2008 9:10 AM
    Monday, July 21, 2008 5:35 PM