Sam_M
Sam_M

Reputation: 65

Missing dll's when compiling c++ programs using mingw compiler in cygwin

When I compile my c++ programs in cygwin with the mingw compiler, the resulting executables don't run because they're missing the following dll's:

An example of a compilation command:

$ x86_64-w64-mingw32-g++ -Wall deque.cc -o deque

I've tried adding the following linker options as well:

-static -static-libgcc -static-libstdc++

But they don't seem to be helping either.

I went looking through my dll's at:

C:\cygwin\lib\gcc\x86_64-w64-mingw32\5.4.0

But couldn't find the dll's there. Is it possible I just don't have these dll's on my computer? If so, where would I get them?

I understand there are other similar questions on stackoverflow, but looking through them I couldn't find any solid answers to this variation of the question.

Upvotes: 2

Views: 3184

Answers (2)

Edgus Michel
Edgus Michel

Reputation: 11

I´ve had the same problem when compiling.

I decided to make a new instalation of cygwin, I followed instructions for a fresh instalation of cygwin from: https://gist.github.com/patrickmoffitt/30684ec23fe82eabe0e3609cab2425b2 (in the point 6) using the package manager, selected the packages to install.... but in my case I also needed to install:

make
gdb

https://www.jetbrains.com/help/clion/quick-tutorial-on-configuring-clion-on-windows.html#Cygwin

At this point, when finish my new instalation, i added in the enviroment variables this route: C:\cygwin64\usr\x86_64-w64-mingw32\sys-root\mingw\bin (this route is where the .dll are)

This worked for me, hope this could help.

Another solution is, copying all the required .dll (form the path I mentioned) and pasting them where the .exe is. Do this every time is a bit annoying.

Upvotes: 1

matzeri
matzeri

Reputation: 8476

Use https://cygwin.com/packages/ to search the contents of cygwin packages.

As reported by https://cygwin.com/cgi-bin2/package-cat.cgi?file=x86_64%2Fmingw64-x86_64-gcc-g%2B%2B%2Fmingw64-x86_64-gcc-g%2B%2B-5.4.0-3&grep=libstdc%2B%2B-6.dll

usr/x86_64-w64-mingw32/sys-root/mingw/bin/libstdc++-6.dll
same for
usr/x86_64-w64-mingw32/sys-root/mingw/bin/libgcc_s_seh-1.dll
usr/x86_64-w64-mingw32/sys-root/mingw/bin/libwinpthread-1.dll

Upvotes: 3

Related Questions