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. Problem about creating DLL in QtCreator
Forum Updated to NodeBB v4.3 + New Features

Problem about creating DLL in QtCreator

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 2.5k Views 1 Watching
  • 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.
  • I Offline
    I Offline
    isml
    wrote on last edited by
    #1

    I am creating a DLL in QtCreator, but encounter a link error:
    @
    testqtdll2.obj:-1: error:LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QString::~QString(void)" (_imp??1QString@@QAE@XZ),the symbol is referenced in "int __cdecl Add(int,int)" (?Add@@YAHHH@Z)
    testqtdll2.obj:-1: error:LNK2019: unresolved external symbol "__declspec(dllimport) public: static class QString __cdecl QObject::tr(char const *,char const *)" (_imp?tr@QObject@@SA?AVQString@@PBD0@Z),the symbol is referenced in "int __cdecl Add(int,int)" (?Add@@YAHHH@Z)
    @

    Test Code:

    @
    #include <QObject>
    #include <QString>

    #include "testqtdll2.h"

    int TESTQTDLL2SHARED_EXPORT Add(int a, int b)
    {
    QString s = QObject::tr("Just a test");
    return a + b;
    }
    @

    Qt project file:

    @
    QT -= gui
    QT += core
    CONFIG += dll
    TARGET = TestQtDLL2
    TEMPLATE = lib
    DEFINES += TESTQTDLL2_LIBRARY
    SOURCES += testqtdll2.cpp
    HEADERS += testqtdll2.h
    TestQtDLL2_global.h
    symbian {
    MMP_RULES += EXPORTUNFROZEN
    TARGET.UID3 = 0xE746BF96
    TARGET.CAPABILITY =
    TARGET.EPOCALLOWDLLDATA = 1
    addFiles.sources = TestQtDLL2.dll
    addFiles.path = !:/sys/bin
    DEPLOYMENT += addFiles
    }
    unix:!symbian {
    maemo5 {
    target.path = /opt/usr/lib
    } else {
    target.path = /usr/lib
    }
    INSTALLS += target
    }
    @

    Thanks in advance

    [EDIT: code formatting: please wrap in @-tags, Volker]

    1 Reply Last reply
    0
    • I Offline
      I Offline
      isml
      wrote on last edited by
      #2

      Could anynone give me a help?

      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