Code::Blocks Forums

User forums => Help => Topic started by: RLFD43 on August 11, 2020, 12:07:14 pm

Title: how to run compiled projects outside of codeblocks?
Post by: RLFD43 on August 11, 2020, 12:07:14 pm
I made a simple text-based command prompt application project on codeblocks on windows. when I run the compiled .exe on codeblocks, it works perfectly fine. but when I run it outside of codeblocks, it gives this error: The program can't start because libstd-6.dll is missing from your computer. Try reinstalling the program to fix this problem. And even when I reinstalled the missing file, it still gave me the same error. please help.
Title: Re: how to run compiled projects outside of codeblocks?
Post by: Miguel Gimenez on August 11, 2020, 12:31:38 pm
You must copy that dll from the compiler folder to the executable folder.

You can also link that library (and other) statically, see Project build options -> Compiler flags -> Static libgcc and Static libstdc++
Title: Re: how to run compiled projects outside of codeblocks?
Post by: gd_on on August 11, 2020, 04:15:58 pm
An other solution, more general, is to add the path where this dll is located to your system path (or user path). For me, it's C:\MinGW64\bin but for you it may be something else, depending where you have installed your compiler. Codeblocks add this path in it's own path, but only for executables executed inside codeblocks : it's why your executable works inside C::B but not as a standalone executable. Adding this path to your system path solves this problem but also if your executable(s) needs some other dll in the same path (for example libgcc_s_seh-1.dll, libstdc++-6.dll, libwinpthread-1.dll, ...)
Nevertheless, consider that static linking is a good solution, especially if you distribute your code or want it to be executed on an other machine.