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. Change Standalone Qt App into Plugin for VS Project
Forum Update on Monday, May 27th 2025

Change Standalone Qt App into Plugin for VS Project

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.9k 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.
  • R Offline
    R Offline
    ReaMix
    wrote on 24 Nov 2011, 02:16 last edited by
    #1

    Using Visual Studio 2008 with the Qt VS add-in, I built a standalone Qt application. Now I want to change its build so another VS project can use it as a plug-in.

    @//ExportMe.h
    #define EXPORT_THIS Q_DECL_EXPORT
    class ExportMeClass : public QWidget {
    Q_OBJECT
    public:
    EXPORT_THIS MyConstructor(QWidget *parent = 0, Qt::WFlags flags = 0);
    ~MyConstructor();
    };

    //ExportMe.cpp
    #include "ExportMe.h"
    extern "C" {
    ExportMe::MyConstructor(QWidget *parent, Qt::WFlags flags) : QWidget(parent, flags) {
    ui.setupUi(this);
    }
    ExportMe::~MyConstructor() {}
    }

    //main.cpp
    #include "ExportMe.h"
    #include <QtGui/QApplication>
    int main(int argc, char *argv[]) {
    QApplication a(argc, argv);
    ExportMe e;
    e.show();
    return a.exec();
    }@

    New Project

    @//IntegratedProj.cpp
    #include "ExportMe.h"
    IntegratedProj::MyConstructor(QWidget *parent, Qt::WFlags flags) : QWidget(parent, flags) {
    ExportMe::MyConstructor(parent, flags);
    }@

    The Problem

    The combined project does not run the plug-in. I have tried the following:

    1. Left the Project Properties the same for both projects, only adding Linker dependencies to IntegratedProj. This produced ExportMe.lib and ExportMe.exe. When I run depends.exe on IntegratedProj.exe, it requires the ExportMe.exe to be in the same directory. This allowed the IntegratedProj to recognize the plug-in, but it did not display the form file (UI). Prefer if final solution does not require adding the ExportMe executable to the IntegratedProj directory (prefer to share a dll).
    2. Changed the Project Properties for ExportMe project so it's General Configuration Type was set to .dll and the Linker Output File was set to .dll. This fails to compile due to Linker error (it cannot find the ExportMe.lib file). This Build configuration does not create a lib file though.

    How can I modify my solution, either in code or Build Properties, to turn the standalone Qt application into a plug-in for a Visual Studio project?

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on 24 Nov 2011, 08:56 last edited by
      #2

      How about creating a separate project for your dll/lib?
      An additional project for your ExportMe.exe. The second project will certainly have to access the dll/lib.

      Depending on the size of the dll/lib part this may be the fastest way to get to a solution.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0

      1/2

      24 Nov 2011, 02:16

      • Login

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