Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Libgcc_s_dw2-1.dll Missing

This thread is locked; no one can reply to it. rss feed Print
Libgcc_s_dw2-1.dll Missing
AceBlkwell
Member #13,038
July 2011
avatar

Hello All,

I'm using Dev-Cpp Portable. I've installed Edgar's Allegro 4.4.3 along with his mingw7.1.0 I'm trying for a static link. The program compiles and links but the EXE file gives me this.

Cant start because libgcc_s_dw2-1.dll is missing from you computer.

What lib am I missing during the link? Or what lib is this file associated with? Maybe I don't have a static version installed.

Thanks
Ace.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

AceBlkwell
Member #13,038
July 2011
avatar

Edgar

Thx for the reply. I'm sure the issue is on my end. I have Allegro443-minGW71v3.7z. So version 3 right.

On a side note can a person static link a DLL file or does it have to be lib files only? Just curious.

I appreciate any insight you might have.

Ace

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

If you didn't static link to the c and c++ runtime libraries, then it will link to the dynamic ones. You need -static-libstdc++ and -static-libgcc at the end of your link line.

If it still fails, I may not have done the same thing on my end.

As a workaround, those two dlls should be in the bin/dlls folder. If not then I definitely need to update the package.

Thanks for testing ')

Edit for your question.
MinGW and GCC use .a archives to link libraries. They can be static or dynamic depending on how they were built. MSVC uses a .lib file for static libraries, and a .dll file for dynamic libraries. They do things differently.

AceBlkwell
Member #13,038
July 2011
avatar

Edgar, Thanks,

Well I found the DLL file if that is an indication to you this is the latest files Also here is the verbiage from the IDE. (below) I see the -static command prefixes the libgcc. Do I add libstdc++ at this location. The file is in the list at the bottom. I assumed the -static command covered everything after it, given it's the first word after the path locations.

Again, I don't think there is an issue with the Allegro files but rather my IDE set up.

Thanks again,
Ace

#SelectExpand
1g++.exe allegro.o board.o keys.o main.o map.o play.o rand.o sound.o target.o title.o -o Dragons.exe -L"E:/Dev-Cpp/MinGW32/lib" -L"E:/Dev-Cpp/MinGW32/i686-w64-mingw32/lib" 2-static-libgcc ../../mingw32/lib/liballeg.a 3../../mingw32/lib/liballeggl.a 4../../mingw32/lib/libjpgalleg.a 5../../mingw32/lib/libloadpng.a 6../../mingw32/lib/liballeg-debug-static.a 7../../mingw32/lib/libvorbis.a 8../../mingw32/lib/libvorbisenc.a 9../../mingw32/lib/libvorbisfile.a 10../../mingw32/lib/libogg.a 11../../mingw32/lib/libpng16.a 12../../mingw32/lib/libzlibstatic.a 13../../mingw32/i686-w64-mingw32/lib/libkernel32.a 14../../mingw32/i686-w64-mingw32/lib/libuser32.a 15../../mingw32/i686-w64-mingw32/lib/libgdi32.a 16../../mingw32/i686-w64-mingw32/lib/libcomdlg32.a 17../../mingw32/i686-w64-mingw32/lib/libole32.a 18../../mingw32/i686-w64-mingw32/lib/libdinput.a 19../../mingw32/i686-w64-mingw32/lib/libddraw.a 20../../mingw32/i686-w64-mingw32/lib/libdxguid.a 21../../mingw32/i686-w64-mingw32/lib/libwinmm.a 22../../mingw32/i686-w64-mingw32/lib/libdsound.a 23../../mingw32/i686-w64-mingw32/lib/libgcc_s.a 24../../mingw32/lib/gcc/i686-w64-mingw32/7.1.0/libstdc++.a

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Link allegrogl, loadpng, jpgalleg, and logg BEFORE allegro, and link "-static-libgcc" and "-static-libstdc++" at the END of the link command. They are different from the "-static" command which instructs gcc to link to the static versions of the libraries that come after it in the linker command.

AceBlkwell
Member #13,038
July 2011
avatar

Thanks Edgar,

I have the files rearranged. May take a little while to figure out how to reposition the -static command in Dev-Cpp. I'll keep you posted.

Ace

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

AceBlkwell
Member #13,038
July 2011
avatar

Edgar,

I'm going to keep plugging away. Not to question someone who knows a whole lot more about linking than I do, but have you compiled anything with the Allegro 4.4.3 v3 to see that the static aspect works? I can't seem to get my programming run though it compiles and links with no critical errors.

Thanks
Ace

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Like I said, I may have forgotten to link the crt statically. It may be my fault. Let me test them and see if they produce any dependency. BRB.

EDIT
I tried compiling a simple allegro program with my binaries and static linking works just fine.

Go to the allegro folder of the distro and run RunA443Examples.bat. That will setup some environment variables for you to compile allegro with.

Add mingw\bin to your %PATH%.

set path=c;\mingw\bin;%PATH%

Now compile your program using the environment I provided. Pass this as the command line and replace test.cpp with your source file.

g++ -Wall -g -o test.exe -DALLEGRO_STATICLINK %A4INCDIR% test.cpp %A4LNKDIR% %A4STATICLIBS%

You should now have test.exe. Enter a new session to test it. Type 'cmd' and hit enter.

cmd
set path=
test.exe

If all goes well your program should run and have no need for any dlls.

Edgar

AceBlkwell
Member #13,038
July 2011
avatar

Edgar,

No luck. I guess I'm just missing the big picture. I can't get the test program to run. I can't get my program to link. Now that I've reinstalled everything I can't get mine to even compile. I get the reference to imp_screen error.

I didn't have any issue with eclipse in Linux. I compiled Allegro 4.4.2 with static option and included the lalleg_s.a file. No issues.

In any case, just for fun and if you have time, wont you see if you can compile and link to static. I'm uploading a 7Z file of my source files and DAT file. If you don't want to mess with it, then don't worry about it. I'm just curious if it's me or the source.

Oh and when I ran the line commands from cmd prompt, gcc could no longer find my include files. See the bat file I created (lot to type each trial)

#SelectExpand
1set path=E:\Dev-Cpp\mingw32\include;E:\Dev-Cpp\mingw32\bin;%PATH% 2g++ -Wall -g -o Dragon.exe -DALLEGRO_STATICLINK %A4INCDIR% allegro.cpp board.cpp keys.cpp main.cpp play.cpp rand.cpp sound.cpp target.cpp title.cpp %A4LNKDIR% %A4STATICLIBS%

Thanks for the tech support :)

Seriously, thanks for the help.
Ace

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

imp_screen error.

This is because you didn't "#define ALLEGRO_STATICLINK" in your source files. The easier way to do it is to pass -DALLEGRO_STATICLINK on your command line.

I tried to compile your code but its missing d_array.h and allcolor.h.

Edit
They're not missing, you're #include'ing them wrong. Use "allcolor.h" not <allcolor.h>. Quotation marks indicate a user include, and brackets indicate a system include. Always use quotes.

Your command line is still somewhat wrong. I had to change it to include map.cpp and I had to export the 'map' function from map.cpp. I cheated and used 'extern' on the declaration in board.cpp but you should really make a separate header for map.hpp.

This is the command I used to get it to compile :

g++ -Wall -g -o Dragon.exe -DALLEGRO_STATICLINK %A4INCDIR% allegro.cpp board.cpp keys.cpp main.cpp map.cpp play.cpp rand.cpp sound.cpp target.cpp title.cpp %A4LNKDIR% %A4STATICLIBS%

One thing, don't edit your %PATH% to search 'include' directories. It's for bin only. The -I switch tells gcc to search the next argument as a path for includes.

Third - you need consistent indentation and braces. Pay attention to compiler warnings about dangling if and else statements.

Here's a 7z of the files as I needed to modify them, including a statically linked Dragon.exe.

https://www.allegro.cc/files/attachment/611024

AceBlkwell
Member #13,038
July 2011
avatar

Edgar,

thanks for the help. Sounds like I really had stuff out of whack. Good thing Linux is so forgiving.

In any case, I never had issues with the map.cpp file. It compiled no problem. The only issue was when running the program it wasn't in static mode. I kept getting the dll error at the prompt.

I took the #define ALLEGRO_STATICLINK out of the source files except for main because I was getting redefining warnings. Actually at one time I have no warnings at all. Just wouldn't go static

Same with the includes. I thought you only put in ' ' when you were going to define actual location 'E:\Dev-Cpp\include\allcolor.h' type thing.

Ill consider the map.h suggestion. Sounds cleaner

I'll look over the code for needed brackets.

Thanks again
Ace

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

AceBlkwell
Member #13,038
July 2011
avatar

Edgar,

I haven't been able to get back to it but based on your comments I have a few ideas. I'll keep you updated

Ace

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Go to: