+ 4

MinGW g++

I compile my cpp code from command prompt with g++, but I can't run the code because libstdc++ and libgcc libraries are missing. I tried to use the -static-libstdc++ and -static-libgcc flags but I get a 2000kb size file (at least runs). Some help here? [Re-posted the question because nobody answered. Deleted the old one]

7th Aug 2017, 12:35 AM
Andrés04_ve
Andrés04_ve - avatar
4 Respuestas
+ 8
I think the codes I compiled using DevC++ were also around 1-2MBish. Not really sure about your case. I've searched about reducing executable size, https://stackoverflow.com/questions/7973274/how-to-reduce-the-size-of-executable-produced-by-mingw-g-compiler Maybe try updating/clean reinstalling if nothing works?
7th Aug 2017, 1:27 AM
Hatsy Rei
Hatsy Rei - avatar
+ 1
my code was a hello world program, with iostream i made one with stdio and got a normal result, ~40kb i saw it's because iostream has some includes such as string, with vectors that have templates and the code gets big, but 2000kb is very big for a hello world!
7th Aug 2017, 1:31 AM
Andrés04_ve
Andrés04_ve - avatar
+ 1
i also saw i may use the -Os flag and then 'strip' the exe
7th Aug 2017, 1:32 AM
Andrés04_ve
Andrés04_ve - avatar
+ 1
I'm wondering because it never happened with dev-c++... Am not I using the same compiler? Its weird
7th Aug 2017, 1:33 AM
Andrés04_ve
Andrés04_ve - avatar