gghuffer
gghuffer

Reputation: 1143

QT The program can't start because libgcc_s_dw2-1.dll is missing

I know this has been asked before but I can't seem to find an answer.

I just have a little hello world console program basically I wrote in c++ with qt creator. When I try to run the executable I get "The program can't start because libgcc_s_dw2-1.dll is missing from your computer. Try reinstalling to fix this problem."

I don't understand why this dll is even necessary for a little program like this. I tried adding these flags as suggested elsewhere:

QMAKE_CXXFLAGS += -static -static-libgcc -static-libstdc++

and it still happens. Other people have suggested adding the directory whee the dll is located to my path but I'd like to actually give this program to someone else without them needing the dll.

Upvotes: 4

Views: 9173

Answers (2)

Ulhas
Ulhas

Reputation: 3

You need to do the below settings in QT Editor Go to the project tab (on the left) to edit the project's setting.

In the section Run Settings, Under Working directory click on the checkbox the Run in Terminal.

Upvotes: 0

Snorre O.
Snorre O.

Reputation: 31

I know this is an old question, and you probably found a solution that worked for you, but I stumbled upon this after a day spent trying to build a statically linked (standalone) application with Qt 5.9.1/MinGW32-5.3.0-32bit.

After building a static version of Qt, it was finally these dynamically linked libraries that MinGW / GCC pulled in that was still holding me back:

libgcc_s_dw2-1.dll
libwinpthread-1.dll
libstdc++-6.dll
libwinpthread-1.dll

After trying countless combinations of:

QMAKE_CXXFLAGS += [-static-libgcc | -static-libstdc++ | -static -lstdc++ -lpthread] 

and other compiler parameters found in threads similar to this one, what finally worked for me was:

QMAKE_LFLAGS += -static

That is, QMAKE_LFLAGS instead of QMAKE_CXXFLAGS and now my program only relies on a bunch of Windows DLL's. :)

Upvotes: 3

Related Questions