#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]
4mb Just for cout?
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:
Select "release" instead of "debug" compiling. That should downsize your program to a few hundred kB''s.
"My basic needs in life are food, love and a C++ compiler"
[Project AlterNova] [Novanet]
"My basic needs in life are food, love and a C++ compiler"
[Project AlterNova] [Novanet]
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
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
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.
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.
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.
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?
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?
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.
How appropriate. You fight like a cow.
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;}
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.
Toolmaker
-Earth is 98% full. Please delete anybody you can.
A hello world app using stdio.h is only 22kb on dev-c++
Stripping it reduces its size to about 10kB.
[ Start Here ! | How To Ask Smart Questions | Recommended C++ Books | C++ FAQ Lite | Function Ptrs | CppTips Archive ]
[ Header Files | File Format Docs | LNK2001 | C++ STL Doc | STLPort | Free C++ IDE | Boost C++ Lib | MSVC6 Lib Fixes ]
Stripping it reduces its size to about 10kB.
[ Start Here ! | How To Ask Smart Questions | Recommended C++ Books | C++ FAQ Lite | Function Ptrs | CppTips Archive ]
[ Header Files | File Format Docs | LNK2001 | C++ STL Doc | STLPort | Free C++ IDE | Boost C++ Lib | MSVC6 Lib Fixes ]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement