2

I am writing a tool with Qt Creator which builds but immediately crashes with the message:

"The program can't start because pthreadVC2.dll is missing from your computer. Try reinstalling the program to fix this problem".

Of course, the "pthreadVC2.dll" library is not missing (and is not corrupted, since it works with other projects), and it is located in the path specified in the Qt pro file:

# DeltaPlots.pro

TARGET = DeltaPlots
QT += core gui
CONFIG += console
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TEMPLATE = app

win32 {
    INCLUDEPATH += S:\\3rdparty\\DFS.Infrastructure.ThreadingW \
                   S:\\3rdparty\\DFS.Infrastructure.File \
            "C:\\path\\to\\boost\\boost_1_51_0"

    win32-g++:LIBS += -L"S:\\lib\\" -lMyLib
    win32-g++:LIBS += -L"S:\\3rdparty\\DFS.Infrastructure.File\\" -lDFS.Infrastructure.FileSystem
    win32-g++:LIBS += -L"S:\\3rdparty\\DFS.Infrastructure.ThreadingW\\" -lDFS.Infrastructure.Threading -lpthreadVC2
}

SOURCES += MainWindow.cpp \
           entrypoint.cpp

HEADERS += MainWindow.h

FORMS   += MainWindow.ui

OTHER_FILES += ProjectList.txt \
               ImageList.txt

Platform:
Windows 7
MinGW
Qt 4.8.3
Qt Creator 2.6.0

Fred
  • 4,894
  • 1
  • 31
  • 48
Pietro
  • 12,086
  • 26
  • 100
  • 193

1 Answers1

1

[Edit: This answer refers to the original question]

Usually you would add

LIBS += -LS:/3rdparty/DFS.Infrastructure.ThreadingW \
        -lpthreadVC2

This adds your library's folder as a library search path (Note the capital -L) and pthreadVC2.lib as a library to link against (lower case -l).

You do not need to add the .dll to the LIBS path, as the .dll is loaded at runtime.

But: This approach only works when the .lib is in the same folder as the .dll. I'm a bit surprised you have yours in different locations.

Maybe adding

LIBS += -LS:/3rdparty

would work, but I'm not sure about that.

In any event, you need to deploy the .dll with your .exe for releases.

Tim Meyer
  • 12,210
  • 8
  • 64
  • 97