Author Topic: how to run compiled projects outside of codeblocks?  (Read 272 times)

Offline RLFD43

  • Single posting newcomer
  • *
  • Posts: 1
how to run compiled projects outside of codeblocks?
« 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.

Offline Miguel Gimenez

  • Lives here!
  • ****
  • Posts: 524
Re: how to run compiled projects outside of codeblocks?
« Reply #1 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++

Offline gd_on

  • Lives here!
  • ****
  • Posts: 570
Re: how to run compiled projects outside of codeblocks?
« Reply #2 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.
« Last Edit: August 13, 2020, 10:59:20 am by gd_on »
Windows 10 64 bits (20.04), svn C::B (last version or almost!), wxWidgets 3.1.4, Msys2 Compilers 10.2.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (sjlj, posix in C:\msys64\mingw32).