[C++] Making a project, exe mysteriously big

Started by
5 comments, last by Fruny 17 years, 6 months ago
Hey! I'm making a project in C++, I'm trying out Rakkarsoft's networking API if anyone is interested. I added all the source files to my project, because that's what they say one should, and it wouldn't work otherwise. Well, so there I am, experimenting. I'm pretty new to C++ too so I just tried to comment out all the code having to do with Rakkarsoft, and left just int main() { return 0; }, to see what would happen. I expected the .exe to be small as with my previous sample programs, but it is still (after commenting out) 6 MB. I thought the linker would only link in what is necessary so this surprises me a bit. What is happening? Also, what is the difference between .lib and .o files?
Advertisement
If you are in debug mode, the executable will be larger than in release mode.
[size="2"]I like the Walrus best.
Hmm, how would I know if I'm in debug mode?
In Visual Studio, you can go under Build->Configuration Manager. You will see a list of all the projects in the current solution. Find the one you're interested in, and under the column labelled "Configuration", change from "Debug" to "Release".
.:<<-v0d[KA]->>:.
Quote:Original post by tufflax
Hmm, how would I know if I'm in debug mode?


If you are using Visual Studio and it is in its default configuration, there should be a combo box that reads "Debug" in one of your toolbars. That's a dead giveaway.

Quote:Also, what is the difference between .lib and .o files?


Very roughly speaking, a .lib is a set of .o packaged for easy reuse.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
I'm using DevCpp but I found where to turn off debug mode, but it's still almost as large. I mean, shouldn't it be small?
Quote:Original post by tufflax
I'm using DevCpp but I found where to turn off debug mode, but it's still almost as large. I mean, shouldn't it be small?


Are you linking in any libraries? Is there code in header files?
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan

This topic is closed to new replies.

Advertisement