[SOLVED]Include external dynamic library in windows application



  • Hello my dear friends
    I have a Project Named Stream with bellow .Pro file

    @
    #-------------------------------------------------

    Project created by QtCreator 2014-05-31T13:54:39

    #-------------------------------------------------

    QT -= gui

    TARGET = Stream
    TEMPLATE = lib

    DEFINES += STREAM_LIBRARY

    SOURCES += stream.cpp
    iodevicesteam.cpp
    memorystream.cpp
    mergedstream.cpp
    substream.cpp
    streamhelper.cpp
    unlimitedstream.cpp
    itemclosemanagement.cpp

    HEADERS += stream.h
    stream_global.h
    iodevicesteam.h
    memorystream.h
    mergedstream.h
    substream.h
    streamhelper.h
    unlimitedstream.h
    itemclosemanagement.h
    IDisposable.h

    unix:!symbian {
    maemo5 {
    target.path = /opt/usr/lib
    } else {
    target.path = /usr/lib
    }
    INSTALLS += target
    }
    @

    it is shared c++ library.

    and I tried to add this Project (Stream) to another console application using add external library of qt creator.this is the code that qtcreator creaded in pro file of that console application.

    @
    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../build-Stream-Desktop_Qt_5_1_0_MSVC2012_64bit-Debug/release/ -lStream
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../build-Stream-Desktop_Qt_5_1_0_MSVC2012_64bit-Debug/debug/ -lStream

    INCLUDEPATH += $$PWD/../../Stream
    DEPENDPATH += $$PWD/../../Stream
    @

    but after this task linker can not link stream library to my console application

    @
    main.obj:-1: error: LNK2019: unresolved external symbol "public: static bool __cdecl StreamHelper::CopyStream(class Stream *,class Stream *,__int64)" (?CopyStream@StreamHelper@@SA_NPEAVStream@@0_J@Z) referenced in function main
    @

    let me tell you that linking stream to any library in linux is like a piece of cake
    any help appreciated



  • I found the problem
    in windows share library all named variables must be exported. In this case they can be used in other Project.(In Unix base os all symbols will be exported automatically.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.