We can use CodeBlocks with mingw to write and build c++ programs in windows 10. But when we try to run a built exe program outside CodeBlocks, a system error may appear, saying, “The program can’t start because libstdc++-6.dll is missing from your computer. Try reinstalling the program to fix this problem.”
There’re two methods to solve the problem.
Method 1(dynamic linking): Add the path of the bin folder of mingw to the Windows “Path” Environment Variable. For example, in my computer, the full path is “C:\Program Files\CodeBlocks\MinGW\bin”. Add the path to “Path” variable, then windows 10 knows where to find the necessary library files and load them every time our program starts to run.
If you’re not familar with this process, read this post.
Method 2(static linking): Right click the project in CodeBlocks manager view and opens “Build options” window. Check the “Static linking [-static]” option in the “Compiler settings“->”Complier Flags“, as the following screen shot shows. Then “Rebuild” the source code and the necessary library files will be included in the final output program.
Recent Comments