If you are using MingW to compile C++ code on Windows, you may like to add the options -static-libgcc and -static-libstdc++ to link the C and C++ standard libraries statically and thus remove the need to carry around any separate copies of those. Version management of libraries is a pain in Windows, so I've found this approach the quickest and cleanest solution to creating Windows binaries.
Another way is if you specify -static it implies -static-libgcc and -static-libstdc++ (as well as linking to all other libraries as static where available). Note that if you are building c++ libraries (like libXX.a type files), they must also be compiled with the same static vs. not or your program will crash.
If you are using MingW to compile C++ code on Windows, you may like to add the options -static-libgcc and -static-libstdc++ to link the C and C++ standard libraries statically and thus remove the need to carry around any separate copies of those. Version management of libraries is a pain in Windows, so I've found this approach the quickest and cleanest solution to creating Windows binaries.
Another way is if you specify -static it implies -static-libgcc and -static-libstdc++ (as well as linking to all other libraries as static where available). Note that if you are building c++ libraries (like libXX.a type files), they must also be compiled with the same static vs. not or your program will crash.
As far as I know, this is the C++ Runtime Library. So it depends on the compiler you use to create your program (A new version will include some C++0x stuff, an older version will probably not for instance. It depends of the compiler and of its version).
If you use MinGW then you should use the libstdc++-6.dll found into the folder of this compiler. MinGW/bin folder should be the place to search for it on your computer.
If you copy this file in the same directory as your executable, it should be OK.
libstdc++-6.dll
mingw - how can i fix "libstdc++-6.dll not found" error in my c++ program? - Stack Overflow
Windows: libstdc++-6.dll was not found
Systeme fault libstdc++-6.dll missing
Videos
I made a small programm, compiled it and sent it toy friends, who informed me of an error where libstdc++-6.dll was not found. How can i fix that?
Hi! I'm taking a C++ class and I've been using Eclipse on Windows 10 to write .cpp files.
Everything has been going great! Lab or Homework Problems usually are along the lines of:
"Write a program that prompts the user to enter in Weight and Height and returns their BMI"
Easy enough: I go to File > New > C/C++ Project > C++ Managed Build > I then give a project name, say "BMI Calculator" > I choose the "Hello World C++ Project" (because I was having issue when I chose "Empty Project") > I choose "MinGW GCC" for my toolchain > Finish
Then in the Project Explorer, I expand my "BMI Calculator" project > expand the "src" folder > and I find my .cpp file.
I'll edit the file, writing code that successfully completes it's job.
When I want to run the program to test it and see if it works, I'll go to File > Save All, then I'll go to Project > Build All, and then I'll go to Run > Run As > Local C/C++ Application. I can see the proper outputs in the convenient "Console" window beneath the open .cpp file I had just created, edited, and saved above. In past problems, I've read in user-entered values from the console window, displayed program outputs to this console window, the whole 9-yards. You know, like a real pro.
We got a new problem this week, write a program that determines if a year is a leap year or not. Easy enough, (a year is a leap year if it is divisible by 4 and not divisible by 100, unless it is also divisible by 400). It's not the problem I'm having trouble with, it's the fact that I need to be able to execute this program from cmd.exe, and I need to pass a value (a single year i.e. 1994, 2004, 2021, etc.) from the command line to the program!
I know, I'm sure this seems trivial, but I've been struggling with it.
I found that Eclipse makes .exe files of your .cpp files. I was able to navigate to the directory that has the .exe file that corresponds to my .cpp file in Windows File Explorer and in cmd.exe, but when I try to run the .exe file in cmd.exe (I go to the folder that has the .exe file and just type [filename].exe), I get two errors:
"The code execution cannot proceed because libstdc++-6.dll was not found. Reinstalling the program may fix this problem"
and
"The code execution cannot proceed because libgcc_s_dw2-1.dll was not found. Reinstalling the program may fix this problem"
What am I doing wrong? I have the MinGW compiler installed on my Windows machine, so I don't know what I'm doing wrong.
Additionally I have absolutely no idea how to edit my .cpp file in Eclipse to allow arguments to pass from cmd.exe, and I have absolutely no idea how to make use of passed values in the .cpp file itself. I've read a bunch of articles on it, but it still makes no sense to me.
One problem at a time, thought.
Would greatly appreciate any help.