The program can't start because libgcc_s_dw2-1.dll is missing from your computer. Simple console - c++

Please help. I am using Code Blocks, and I have just built a project and now when I try to run the ".exe" it says this message "The program can't start because libgcc_s_dw2-1.dll is missing from your computer...this problem." I have tried to download those .dlls and extract them into the location where the ".exe" is stored and then tried running the program again but it crashes. I have no idea what to do anymore.
Can anyone give me steps to solving this using Code Blocks(IDE. that I use)? Please.
Another note that I'd like to add is that I am learning C++ and I do not understand complicated lingo like "linker", "links", and etcetera. I want this application to be stand-alone if possible but I have searched around about this issue and people are saying to place the related .dlls from the bin of minGW where your executable is but then they say that there is licensing issues. I am getting confused about this and I just want a simple fix, I don't want any licensing issues.
Can you explain it from Code Blocks point of view? Because that's the program that I am using, and some steps to fix it would be really nice.
Note 3: People are also saying to use something like "-static-libgcc" but I have no idea what to do with that.

The libgcc_s_dw2-1.dll should be in the compiler's bin directory.
You can add this directory to your PATH environment variable for runtime linking, or you can avoid the problem by adding -static-libgcc -static-libstdc++ to your compiler flags.

Related

DLL Error Following the tutorial for gtkmm

I'm following the gtkmm tutorial for gtkmm4 and I'm getting an odd error when I try to run my program. The program is an exact copy of the provided code, and it compiles successfully:
However, when I run the program it gives me a series of errors:
I'm not sure what to do at this point. I've tried googling, but I don't get anything helpful. I've check that the DLL in question does exist. Any advice is appreciated!
Edit: I ran the Dependency Walker program, and got some errors, not sure what this means though.
Edit2: I did some research on Dependency Walker, and it seems to have some known issues, so I also ran lucasg's "Dependencys" program, with this output. I'm still not really sure what this means, but it seems fine.
Edit3: I moved the 4 offending dll files into the build directory, and these are the new errors I'm getting. Its the same error, but now it points to the more local file.
Check your .exe file with Dependency Walker to see which issues there are loading the .dll files.
One possible cause could be that you're mixing 32-bit and 64-bit.
The issue was something to do with finding the correct DLLs. The solution, as outlined here, is to copy all the DLLs from C:\msys64\mingw64\bin into the build directory. Then, using ntldd or some other profiler, determine which DLLs are unnecessary and remove them.

OpenAL32.dll missing error

I have downloaded gorilla-audio source code to use it in my software, but when I use the external library from OpenAL (in gorilla-audio, the OpenAL32.lib) the project compiles with no errors or anything, but it doesn't run normally, I still haven't implemented anything from gorilla sound, just wanted to check that after adding the library it would still work the same before editing anything, but it just doesn't, I have linked everything and used the correct version of .lib but when I run the project it says:
The program can't start because OpenAL32.dll is missing from your
computer. Try reinstalling the program to fix this problem.
What should I do, I've googled that but I'm just scared to download random things, plus I don't even know where should I put it.
Any help guys,
Thanks ^_^

How to Make a Standalone static executable with CLion that can run on anyone's computer for C++?

My question is regarding CLion by JetBrains.
I come to understand that with visual studio there is an option to set the executable to be "multithreaded" and not "multithreaded dll". In other words this would allow for the .exe to be used on anyones computer after compiling.
My question is similar but for CLion.
How in the world do I set the same option inside of CLion? At first when not being able to find it I realized I need to edit CMAKE.txt
I also found that I can use the -static option but when I typed in:
set(CMAKE_EXE_LINKER_FLAGS "-static")
When I put that in it didn't work. What else do I need to do to run a .exe on anyones computer with CLion and how should I go about doing this?
Sorry for not knowing. As a matter of fact I'm new to C++ and just started learning and picked up the C++ Bible to try to learn.
To be honest, I don't see a point in making a program if you can't share it with other people. Even if they installed visual runtime libraries or whatever library they would need it's pretty pointless so that's why I found static is the best way to go.
I just don't know how for CLion.
Thank you.

"sfml-system.dll" is missing from your computer, error

I've been following the Code Blocks installation tutorial for SFML: http://sfml-dev.org/tutorials/1.6/start-cb.php
I did everything in the tutorial, but when I compile, I get the error saying:
"The program can't start because sfml-system.dll is missing from your computer. Try reinstalling the program to fix this problem.
I've been scouring Google for solutions, but nothing has worked so far. Stuff I've tried:
-Moving the sfml-system.dll into the same directory as my .exe
-Changing the "debug" linker options to static and dynamic.
Any help on this issue will be greatly appreciated, thanks!
Carpetfizz
First, your link is for 1.6. The most recent version is 2, which might be better. (in terms of organization/ability etc - more time of improvements added to it in theory).
In the download of SFML I have had, the DLL's are in the SFML/bin folder, or something similar. When I have gotten this error before, it was when I was trying to link dynamically to them and the DLL was not, as you said, in the directory.
Ah. Assuming the directory is not the problem (you could try to put it right next to it just to be sure), looking at the tuturial in question says that you need to also define SFML_DYNAMIC. For some reason I feel like it said if you use gcc this did not make a difference, but that was probably the 2 tuturial (which might have different listed version of gcc), so I would try that. (near the bottom of the page).

How to run C++ program that use PDCurses on other computers?

I've recently started using PDCurses in a C++ game I'm working on. When I compile the program on my own machine (windows) and run the .exe, everything works as it should.
When I take that .exe onto a different computer that doesn't have PDCurses and I try to run it, I get an error about a missing pdcurses.dll file.
After doing a bit of research online, I found out that including the .dll file along with the .exe should make it run but it didn't work for me.
This is how I compiled the program using MinGW: g++ game.cpp -o game -lpdcurses
So my question is, how do I make this program run on computers that don't have PDCurses setup, and also, is there a way to do this by combining the .exe with whatever additional file(s) the system needs to run the program? I've also read that you can do some sort of static linking but so far I've been unable to find a way to do this.
Thanks in advance for the help.
NOTE: In case it matters, I setup PDCurses following this tutorial: http://comptb.cects.com/1848-adding-pdcurses-to-mingw
Not sure if that was the best way to do it but I'm able to compile and run C++ code that uses pdcurses on my computer fine.
Sorry for not posting the exact messages. Here they are:
The first one I got when I didn't include the pdcurses.dll file along with the executable said :
The program can't start because pdcurses.dll is missing from your computer. Try reinstalling the program to fix this problem.
The second one I got after I included the pdcurses.dll:
*The program can't start because libcc_s_dw2-1.dll is missing from your computer. Try reinstalling the program to fix this problem.*
You need to include all the dynamic libraries you linked with. Be careful of licensing, although IIRC there's not much that will bite you with MinGW.
There should be a 'ldd' command if you have the MinGW shell. Try running it on game.exe and it will tell you what libraries you need to run your program. You need to include them all with the exe.
If you want to try and remove the dependency nightmare you can use the static linking (-static) option to your gcc link command. You may not be able to actually do that if you don't have the static versions of your libraries installed. This has other implications - your exe will be bigger and the OS's shared shared page code will not work because it can't tell what parts (DLL code) you are sharing with other apps. In effect, your application will use more memory as a result, although it may be insignificant.
Another option is to get the sources to PDCurses and compile it as a static library. That way you don't have to get involved in the DLL Hell.
Compile it as a C library instead of a C++ library and you should be good to go.