Search code examples
c++linkermakefilegnu-makecodelite

How to reduce exe size produced with CodeLite mingw 4.7.1


I'm new to CodeLite

everytime I press F7 to compile the project, it produce a huge exe

#include <iostream>

int main(int argc, char *argv[]){
        return 0;
}

short code but 900KB

I've switched to release mode, and the problem still remain.

And 've tried the same command line on my own in CMD, g++ produce only 49 KB

I guess the makefile used by codelite is the key??


Solution

  • The size of the executable is not related to the Makefile, but because of the inclusion of iostream (removing it will reduce your exe to the minimum)

    However you might want to add '-s' to the linker options from: project settings -> common settings -> linker

    adding '-s' will reduce the executable by half to around ~400KB in release mode. You can also try and run 'strip' on the executable

    Eran