Question

I need to build some DLLs using Qt 5, but I must be doing something wrong since the program that needs it isnt working. I know there is something wrong because when I run the dependency walker on any of the builded dlls, it says there are wrong linkings or that it cannot find certain DLLs:

enter image description here

I believe it is because some things are in x64bits while others in x32bits. I am working on a 64bits platform, but I am trying to build a 32bits application with 32bits DLLs. I use 32bits mingw compiler, 32bits Qt version, 32bits everything but OS. To be honest Im rather newbie on this and Im somewhat lost, could someone point me in the right direction? Whats wrong with my compiling?

This is the .pro file of the shown DLL:

TEMPLATE = lib
TARGET = QENC
DESTDIR = ../release
QT += core gui widgets
CONFIG += release
DEFINES += QENC_LIB QT_DLL
INCLUDEPATH += ./GeneratedFiles \
    ./GeneratedFiles/Release \
    . \
    ../../../proj-4.8.0/src
DEPENDPATH += .
MOC_DIR += ./GeneratedFiles/release
DLLDESTDIR += release
OBJECTS_DIR += release
UI_DIR += ./GeneratedFiles
RCC_DIR += ./GeneratedFiles
include(QENC.pri)

PS: I even get errors in the QtCored.dll and other DLLs that Qt installs :S it might be nothing or it could be the source of the error.

Was it helpful?

Solution

Things to check when deploying on Windows:

  1. Built in release mode - in PRO file you have CONFIG += release so this should be okay, you may also want to add a CONFIG -= debug debug_and_release line, just to be sure

  2. If using MSVC - Linked against the release version of the C library (/MD) not debug (/MDd)

  3. You are deploying the release version of Qt DLLs (QtCore4.dll) not debug with a d at the end (QtCored4.dll)

  4. You are deploying the correct DLLs for your compiler - the Qt that comes with GCC included will have two versions of the DLLs, ones built with GCC that your program will link against, and ones built with MSVC that the pre-built tools (like qmake) will link against.

  5. If using MSVC, that you have all service packs and updates installed, and that the MSVC re-distributable you ship matches the compiler exactly.

This is quite tricky to get correct, if I've missed something, let me know.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top