'Executable size is very big
#include <iostream>
int main() {
std::cout << "HI";
}
this is the code. after compiling it is 220kb.
I used this command : cl /EHsc main.cpp.
help me reduce the size
Solution 1:[1]
You can get a huge difference by not linking statically to the runtime. In addition to the optimization flags, use /MD to use the runtime DLL.
I get the .exe size down to 11 kB.
And even if you do
#include <iostream>
int main() {
std::cout << "HI";
std::cout << "HI";
std::cout << "HI";
std::cout << "HI";
}
it is still 11 kB, so it is not growing by 220 kB per source line. :-)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | BoP |
