Link DLL and LIB into workplace
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Link DLL and LIB into workplace

  1. #1
    Join Date
    Nov 2003
    Posts
    19

    Link DLL and LIB into workplace

    Hi, I am currently testing 2 DLL and LIB. However I don't know how to link/insert these DLL and LIB into my MFC project?

    Should I just insert project into workspace?

    I tried to include some header files from other project as well. But the compiler returns me 'cannot open include file'. What is wrong?

    I am using VS 6.

    It is urgent. Hope someone can help me here.

    Thank you.

  2. #2
    Join Date
    Feb 2003
    Location
    Bilbao
    Posts
    513
    If you are linking the DLL implicitily you have to add the *.h and the *.lib, and store the DLL in the application directory or in the Windows system directory.

    If you are using it explicitely (LoadLibrary), you don´t need to add any file.
    Caronte
    Si tiene solución... ¿por qué te preocupas?
    Si no tiene solución... ¿por qué te preocupas?

  3. #3
    Join Date
    Nov 2003
    Posts
    19
    I see.

    I am not sure whether I have done is correct or not.

    I have this dll called 'com.dll'. I have all the files to develop this dll.

    Now in my won workspace called 'test', I want to open a serial port. 'com.dll' could do everything for me, but I need to give the portname and baud rate.

    #include portRSR232.h //this file is in the folder to build the DLL

    in my callforPortfunc()
    {
    .....
    s8* name = "COM1";
    port = new RS232Port(name);
    port->openPort();
    }

    However, I got these errors as below. Is there any where in VS6 where I need to define the path for the DLL?


    FlashZap_TestDlg.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall RS232Port::setDevicePath(char const *)" (?setDevicePath@RS232Port@@UAEHPBD@Z)
    FlashZap_TestDlg.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall RS232Port::getDevicePath(void)" (?getDevicePath@RS232Port@@UAEPBDXZ)
    FlashZap_TestDlg.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall RS232Port::waitForDisconnect(void)" (?waitForDisconnect@RS232Port@@UAEHXZ)
    FlashZap_TestDlg.obj : error LNK2001: unresolved external symbol "public: virtual unsigned int __thiscall RS232Port::GetPortType(void)" (?GetPortType@RS232Port@@UAEIXZ)
    FlashZap_TestDlg.obj : error LNK2001: unresolved external symbol "public: virtual unsigned int __thiscall RS232Port::getBaudRate(void)" (?getBaudRate@RS232Port@@UAEIXZ)
    FlashZap_TestDlg.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall RS232Port::changeBaudRate(unsigned int)" (?changeBaudRate@RS232Port@@UAEHI@Z)
    FlashZap_TestDlg.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall RS232Port::writePort(unsigned char *,unsigned int,unsigned int)" (?writePort@RS232Port@@UAEHPAEII@Z)
    FlashZap_TestDlg.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall RS232Port::readPort(unsigned char *,unsigned int,unsigned int)" (?readPort@RS232Port@@UAEHPAEII@Z)
    FlashZap_TestDlg.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall RS232Port::closePort(void)" (?closePort@RS232Port@@UAEHXZ)
    FlashZap_TestDlg.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall RS232Port:penPort(void)" (?openPort@RS232Port@@UAEHXZ)
    FlashZap_TestDlg.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall RS232Port::RS232Port(char const *)" (__imp_??0RS232Port@@QAE@PBD@Z)
    FlashZap_TestDlg.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall RS232Port::~RS232Port(void)" (__imp_??1RS232Port@@UAE@XZ)
    Debug/FlashZap_Test.exe : fatal error LNK1120: 12 unresolved externals
    Error executing link.exe.

  4. #4
    Join Date
    Nov 2003
    Posts
    19
    Hi I think I have solved the problem. It is dependencies problem.
    Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center