MinGW install

Hi,

I've installed the MinGW compiler and have set the path already. When I simply do g++ helloworld.cpp -o helloworld.exe to compile, it gives me an error for missing libstdc++-6.dll . I looked up this problem and found a solution was to instead put g++ helloworld.cpp -o helloworld.exe -static-libgcc -static-libstdc++ and it worked. I can see typing all of this to compile each program getting pretty tedious and kind of hard to remember. Is there any work around to not have to type all of this or is this the only way? Thanks.
Yes. Use a version of MinGW that links libstc++ statically by default, like this one:
http://tdragon.net/recentgcc/
In the Command Prompt you can probably press the up key to repeat previous commands that you have run.

If you use an IDE you can probably specify what commands to use to compile your program.

On Linux we often write Makefiles for these kind of things but I'm not sure how easy that is on Windows. For a simple one file program like this you could write a batch file. Simply put you command g++ helloworld.cpp -o helloworld.exe -static-libgcc -static-libstdc++ in a file named build.bat (or whatever you want to call it as long as it ends with .bat). Then you can just type build to compile your program.

Last edited on
Topic archived. No new replies allowed.