Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Webbster

4mb Just for cout?

This topic is 5398 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Okay so, just recently I've been noticing a huge drop in Hard-Drive space, and all this fits in with my programming, so i open my main programming folder (where i keep all my VC++ projects) to find that it totals to around 20mb!! Just for a few (4) console based programs. To test just how weird this is, i created a very very basic program for the console:
 

#include <iostream>

using namespace std;

int main()
{
     cout << "Hello World!";
     return 0;
}

Okay very simple! Then i compile it only to find that the project is 4MB! im using VC++ 6.0, have i not configured something correctly, whats going on? Thanks Ad PS Anyone providing help please keep it simple for me (i am not very familiar with the VC++ 6 program, just C++, maybe i should get a book lol) [edited by - Webbster on September 3, 2003 12:38:11 PM]

Share this post


Link to post
Share on other sites
Advertisement
1: Compile with ''Release'' settings.
2: Discard unused libs with linker options (''Release'' already handles this, if you''ve not changed the settings).
3: Turn on optimization for small code (in compiler options).
4: Make sure you don''t compile debug info into the exe.
5: Make sure the align size is sane.

And such...

rgds Nik

Share this post


Link to post
Share on other sites
There can also be a lot of intermediate files created by VC in the Debug or Release folder within your project directory. In most cases it is harmless to delete most of those, at the expense of a total recompile the next time you''d need to compile.

Share this post


Link to post
Share on other sites
The same code, using mingw32-g++, totals 220kB once stripped.

Unlike the C library, a lot of the C++ library always gets compiled in with your code. The first use of a given library function may therefore be costly, but further use isn''t - your example is an extreme case of that. Decent platforms however, do keep iostreams in a library you can dynamically link against - try linking against the "Multithreaded DLL" runtime (/MD or /MDd for debug)

There are techniques to reduce executable size.

Share this post


Link to post
Share on other sites
Okay thats got it down to 2mb.

Could these files have anything to do with it:

\debug\test.pch
\debug\main.obj
\debug\vc60.idb
\debug\vc60.pdb

The compiler keeps creating them and the test.pch file is the largest at around a megabyte, anyway of turning these off or is this the smallest file size I can get the entire project?

Share this post


Link to post
Share on other sites
VC creates them for various reasons. You can delete them whenever you want, but they''ll be recreated, and deleting them every time will slow down builds. But why would you care about this? these files aren''t required to be released with your program.


How appropriate. You fight like a cow.

Share this post


Link to post
Share on other sites
A hello world app using stdio.h is only 22kb on dev-c++


#include <stdio.h>


int main(int argc, char *argv[])
{
printf("Hello world\n");
return 0;
}

Share this post


Link to post
Share on other sites
If you are programming on a large project, these files can easily total 20 mb(My current project). No big deal, imho. When I think a project is completed(Everything works as it should to my idea) I release the application/game/etc. and delete all the intermediate files in the Debug and Release folders. I just leave the exes in the directories(Well, only release mode exe).

Toolmaker



-Earth is 98% full. Please delete anybody you can.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!