Intro
I have a CMake-based C project. Until now I build and ran the project via CLion. Everything worked fine until I tried to run the .exe-file directly (not via CLion).
Problem
When I navigate to the cmake build directory in order to start my program via the executable file, it fails with the following message in the popup: Cannot continue the code execution because libgcc_s so-1.dll was not found. Reinstalling the program may resolve the issue.
I have the following questions
- If I interpret the error message correctly, then this dll is missing on my computer. So I ask myself, why does my program still work when I start it via the development environment (CLion), although the error message expressly states that the source code requires this dll?
- Is it the fault of my application/source code that the error appears or rather the current state of my computer? If the former, how can I prevent this error from appearing for other users?
- What is the best way to fix this error? It's obvious that I need to download this dll, but where is the best place to put it (which directory and environment variable to use on Window)?
- Which source is trustworthy to download this dll? I don't want to download any malware under this dll-name.
- Optional: What kind of library is that? What functionalities does it offer?
Additional information
I use CMake as my build tool, CLion as the IDE and MinGW as the compiler.
What I have did so far?
- I made sure it still works through the IDE.
- I found this dll does not exist in the MinGW installation folder.
- I searched the web for more information. Unfortunately, there are only pages unknown to me that only offer the download of this dll. That doesn't satisfy me.
CodePudding user response:
This file is part of MinGW-w64 when using SEH as exception model (as opposed to Dwarf or SJLJ). You need to distribute the .dll
files your .exe
file(s) depend on in the same folder as the .exe
file(s).
If you don't have that file, then you probably have been using libraries compiled with different versions of GCC/MinGW(-w64). I recommend building everything with the same compiler to ensure stable binaries.
Tools like Dependency Walker can help you figure out which .dll
files your .exe
file depends on.
Or use the command line tool copypedeps -r
from https://github.com/brechtsanders/pedeps to copy the .exe
files along with it's dependencies.
CodePudding user response:
As stated in the comments, if the IDE successfully compiles and runs the program, the DLL must be available on my system. Therefore, I started a search for this DLL all over my file system. Indeed, it exists, but surprisingly not in my MinGW installation directory, but in the Tor Browser installation directory: C:\Users\Me\Desktop\Tor Browser\Browser\TorBrowser\Tor. For test purposes I simply copied the DLL into the directory with the exe, now I get an error with the following error code: 0xc000007b
CodePudding user response:
I found the cause of my problem: I had two MingGW installations on my machine. Once the installation that comes with CLion and a separate one. The latter did not have the required dll. However, CLion used its own installation, which in turn owns the DLL. So the solution was to remove the separate installation and include the path to the CLion installation's bin/ directory in the PATH environment variable.