libwinpthread-1.dll , libgcc_s_seh-1.dll , 0xc000007b issues
Answered
Im trying to run a console "mini-game" but i have a problems when trying the "random" library.
The thing is that when i try to run the game in clion it works, but if i want to run it using my game.exe in my project folder, it first says i need the "libgcc_s_seh-1.dll" file. After its installation, "libwinthread-1.dll" is required.
And when everything seems to be fine it says it couldn't run the application because of this error -> 0xc000007b.
These are the responsible lines :
std::random_device rd;
std::mt19937 mt(rd());
std::uniform_int_distribution<int> dist(4, 77);
rock.move(dist(mt));
Sorry for my english ^^
Please sign in to leave a comment.
@Mateo1198 what toolchain did you use to build the application in CLion? You need to add the bin subfolder of this toolchain's folder to your system path: "Control Panel" ⇒ (Optional) System and Security ⇒ System ⇒ Advanced System Settings ⇒ "Advanced" tab ⇒ Environment Variables ⇒ System Variables ⇒ Select variable named "PATH" ⇒ Edit ⇒ Add the necessary path to the existing PATH entry.
For example, I used MinGW-64 installed in "C:\Program Files (x86)\mingw-w64\i686-7.2.0-posix-dwarf-rt_v5-rev1\mingw32" to build the application in which source code the "std::random_device rd;" line was presented. So I added "C:\Program Files (x86)\mingw-w64\i686-7.2.0-posix-dwarf-rt_v5-rev1\mingw32\bin" to the system path and after that was able to run ("Run as administrator") the .exe file outside CLion.
Well, that was exactly my problem. Thank you very much for your help, Anna
If you would like to enable other people (who probably do not have MinGW-64 installed) to run the executable on their computer, it would be better to include the static libraries in the executable, right?
That would mean adding the line
to your CMakeLists.txt file, AFAIU. Can you confirm, @Anna?
Hi, Snereregor, thanks a lot for your comment! Yes, this should also solve the issue, but will increase the size of the .exe though.
Static compilation is probably best for convenience. I'd love if CLion offered a simple checkbox in the toolchain configuration (or somewhere else easy to find) to enable that, and an option to automagically copy the mingw dlls into the output directory to be picked up runtime without explicitly adding mingw to the system path.
Do distribute the mingw64/licenses/gcc/COPYING.RUNTIME with your application though (and possibly others).
@J.T. Wenting, thank you for the suggestion! I've added it in the comments to https://youtrack.jetbrains.com/issue/CPP-71. The request may look like a request about the find packages case, but it's about improving CMake GUI in general.