Question

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??

Was it helpful?

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

OTHER TIPS

Pass -ffunction-sections to every compilation and --gc-sections to the final link (or -Wl,--gc-sections to gcc) to enable stripping of dead code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top