development

libgcc_s_dw2-1.dll이 누락되어 프로그램을 시작할 수 없습니다

big-blog 2020. 6. 7. 00:49
반응형

libgcc_s_dw2-1.dll이 누락되어 프로그램을 시작할 수 없습니다


Code :: Blocks를 사용하여 C ++로 간단한 프로그램을 만들었습니다.

Code :: Blocks에서 실행하면 올바르게 작동합니다. 그러나 실행 파일을 두 번 클릭하여 실행하면 다음 메시지가 표시된 창이 나타납니다.

libgcc_s_dw2-1.dll을 (를) 컴퓨터에서 찾을 수 없어서 해당 프로그램을 시작할 수 없습니다.
이 문제를 해결하려면 프로그램을 다시 설치하십시오.

그래서 무엇이 문제입니까? 문제를 해결하려면 어떻게해야합니까?


나는 이것이 Microsoft Visual Studio 설정이 아니라 MinGW / gcc 컴파일러 문제라고 생각합니다.

libgcc_s_dw2-1.dll컴파일러의 bin 디렉토리에 있어야합니다. 런타임 링크를 위해이 디렉토리를 PATH 환경 변수에 추가하거나 컴파일러 플래그에 "-static-libgcc -static-libstdc ++"를 추가하여 문제점을 피할 수 있습니다.

실행 파일을 배포하려는 경우 후자가 가장 적합합니다. 자신의 컴퓨터에서만 실행하려는 경우 PATH 환경 변수를 변경하는 것이 매력적인 옵션입니다 (실행 파일의 크기를 유지함).

업데이트 :

Greg Treleaven의 의견을 바탕으로 (아래 의견 참조) 다음 링크를 추가합니다.

[Code :: 스크린 샷 "프로젝트 빌드 옵션"차단

[GNU gcc 링크 옵션]

후자의 논의는 포함 -static-libgcc하고 -static-libstdc++링커 옵션.


Eclipse에서는 프로젝트 속성> C / C ++ 빌드> 설정> MinGW C ++ 링커> 기타에서 찾을 수 있습니다.

맨 위에있는 "링커 플래그"에 추가해야합니다. 다른 곳. 그런 다음 다시 빌드하십시오.

이클립스 속성 스크린 샷

I have found that linking those statically explodes the size up to 1,400kb even with optimizations. It's 277kb larger compared to just copying over the shared DLLs. It's 388kb larger as well after UPXing everything. Very lose/lose here. Just include the DLLs as the end-user can decide to delete them or not if they have them installed elsewhere.


Code::Blocks: add '-static' in settings->compiler->Linker settings->Other linker options.


See also. It solved my problem.

By the way, is it definitely compiler flag? Maybe linker is the more suitable term here?


Find that dll on your PC, and copy it into the same directory your executable is in.


Copy "libgcc_s_dw2-1.dll" to were make.exe is. (If you are using Msys, copy it to \msys\bin) Make sure that the path to make.exe is set in the env. PATH (if make.exe is in a folder "bin", most likely, and you have msys, it's \msys\bin) Compile, rund, debug, etc. happy.


I was able to overcome this by using "gcc" instead of "g++" for my compiler. I know this isn't an option for most people, but thought I'd mention it as a workaround option :)


Can't you put it in system32 or something like you do with others dll files, so that every program you try to run won't have that problem on your machine?

I just need the path where to put it.

It is kinda annoying to put it in the directory every time I run a program I just built...

Edit: I found the solution:

Extract libgcc_s_dw2-1.dll to a location on your computer. We recommend you to unzip it to the directory of the program that is requesting libgcc_s_dw2-1.dll.

If that doesn't work, you will have to extract libgcc_s_dw2-1.dll to your system directory. By default, this is:

  • C:\Windows\System (Windows 95/98/Me)
  • C:\WINNT\System32 (Windows NT/2000)
  • C:\Windows\System32 (Windows XP, Vista, 7)

If you use a 64-bit version of Windows, you should also place libgcc_s_dw2-1.dll in C:\Windows\SysWOW64\

Make sure overwrite any existing files (but make a backup copy of the original file). Reboot your computer.

If the problem still occurs, try the following:

  • Open Windows Start menu and select "Run...".
  • Type CMD and press Enter (or if you use Windows ME, type COMMAND)).
  • Type regsvr32 libgcc_s_dw2-1.dll and press Enter.

Just go to Settings>>Compiler and Debugger, then click the Linker Settings tab and go over to the "Other linker options" edit control and paste: "-static-libgcc -static-libstdc++" to it, there is no compiler flag option in the Compiler Flags options for Code::Blocks so that's the way to solve that problem, I came here looking for a solution also and the one guy that posted about "-static-libgcc -static-libstdc++" gave the right idea, and I sort of figured the rest out by accident but it worked, the file is clickable now from outside Code::Blocks, works right from the desktop.


Go to the MinGW http sourceforge.net tree. Under Home/MinGW/Base/gcc/Version4(or whatever version use are using)/gcc-4(version)/ you'll find a file like gcc-core-4.8.1-4-mingw32-dll.tar.lzma. Extract it and go into the bin folder where you'll find your libgcc_s_dw2-1.dll and other dll's. Copy and paste what you need into your bin directory.


Add path to that dll into PATH environment variable.


Add "-static" to other linker options solves this problem. I was just having the same issue after I tested this on another system, but not on my own, so even if you haven't noticed this on your development system, you should check that you have this set if you're statically linking.

Another note, copying the DLL into the same folder as the executable is not a solution as it defeats the idea of statically linking.

Another option is to use the TDM version of MinGW which solves this problem.

Update edit: this may not solve the problem for everyone. Another reason I recently discovered for this is when you use a library compiled by someone else, in my case it was SFML which was improperly compiled and so required a DLL that did not exist as it was compiled with a different version of MinGW than what I use. I use a dwarf build, this used another one, so I didn't have the DLL anywhere and of course, I didn't want it as it was a static build. The solution may be to find another build of the library, or build it yourself.


Working with msys2 I have obtained the same error trying to execute release version of my project in a debug environment. The solution for my problem is obvious: use executable with debug symbols.

참고 URL : https://stackoverflow.com/questions/4702732/the-program-cant-start-because-libgcc-s-dw2-1-dll-is-missing

반응형