Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED]Include external dynamic library in windows application
QtWS25 Last Chance

[SOLVED]Include external dynamic library in windows application

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 908 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    arashjfz
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • A Offline
      A Offline
      arashjfz
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved