Help using Qt in Plugns

Hello, I’m testing Qt with plugins but I have a problem: the plugin won’t load.

I’m using the same Qt version of my client (5.12.3).

I can successfully build the .dll but once in the ts3 plugin floder it won’t load in the client.

This is my Makefile:

CC = g++
LIBS = -L'E:\Programmi\Qt\5.12.3\mingw73_64\lib' -lQt5Core -lQt5Widgets
INCS += -I'E:\Programmi\Qt\5.12.3\mingw73_64\include'
INCS += -I'E:\Programmi\Qt\5.12.3\mingw73_64\include\QtCore'
INCS += -I'E:\Programmi\Qt\5.12.3\mingw73_64\include\QtWidgets'
ARGS = -std=c++17 -Wall -g $(LIBS) $(INCS)

SRC_DIR = src
BUILD_DIR = build
APP_NAME = ts3qt.dll

plugin.o:
    $(CC) -DBDLL -c $(SRC_DIR)/plugin.cpp -o $(BUILD_DIR)/plugin.o $(ARGS)

all: plugin.o
    $(CC) -shared $(BUILD_DIR)/plugin.o -o $(BUILD_DIR)/$(APP_NAME) $(ARGS)

This is the piece of code where I call a Qt function:
(I’m including: QtCore and QtWidgets)

void ts3plugin_onMenuItemEvent(uint64 serverConnectionHandlerID, enum PluginMenuType type, int menuItemID, uint64 selectedItemID) {
    switch(menuItemID) {
        case MENU_ID_GLOBAL_1: {
            ts3Functions.logMessage(qApp->applicationName().toStdString().c_str(), LogLevel_INFO, "", 0);

            break;
        }
    }
}

Anyone have an idea how to make it work? Thanks!

Could you be a bit more specific on that?
If it is in the plugin folder it should be loaded or an error displayed in the settings.

You will need to use MSVC with the v140_xp toolset.

1 Like