Archived

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

Build in C++.net

This topic is 5604 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

I wrote a simple application that display a image using C++.net I didn''t use MFC and had define #WIN32_LEAN_AND_MEAN. But my release build file size was about 1.44M, I see no reason to have such a big file size for my application. Does anyone know what Complier option I may have set wrongly to general such large file ? following Lib was found in Linker command-line kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ddraw.lib dxguid.lib D3d8.LIB D3dx8.lib

Share this post


Link to post
Share on other sites
I don''t know what''s different about VC++.net as opposed to VC++6, but in VC++6 making sure you have it set to "Release" as opposed to "Debug" cuts down the file size fairly significantly...

Did you do that?

Share this post


Link to post
Share on other sites
Several things may be the result.

1) Make sure you're actually compiling to a pure executable and not the generic .NET type executable VS.NET can make (not exactly sure how I can explain this clearly).
2) Start an empty project, and not try not to use precompiled headers. (like stdfx.h, or something like this). Not sure why that would make a difference.
3) Include fewer libraries, and only use what you definately need.
4) Don't include the texture as a resource in the executable. That's my guess at why its happening.

I have a program which displays a texture and a fair bit more (runs off a script).

Program: 72kb
Script: 432 bytes (4kb used)
BMP's: 56kb

linked libs:

d3d8.lib winmm.lib dxguid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

Compiler settings:

/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Fp"Release/test.pch" /YX /Fo"Release/" /Fd"Release/" /FD /c

[edited by - Nytegard on August 16, 2002 1:05:24 AM]

Share this post


Link to post
Share on other sites
quote:
Original post by Nytegard
1) Make sure you''re actually compiling to a pure executable and not the generic .NET type executable VS.NET can make (not exactly sure how I can explain this clearly).


Actually, a comparable .NET exe would be far smaller than this.


Share this post


Link to post
Share on other sites
Did you try turning off managed C++? Then if on release build open the properties for the soulotion and then go under C++/Optimizations and change to favor small code.

Share this post


Link to post
Share on other sites
Actually, a managed C++ application is tiny compared to a similar non-managed one.

My guess would be that your image is a resource in the executable, right? That''s why it''s so big, the image is probably stored uncompressed...

Also, defining WIN32_LEAN_AND_MEAN won''t do much in the way in decreasing your executable size (at least, not that much). The main reason for it is decreasing compile times.

If I had my way, I''d have all of you shot!


codeka.com - Just click it.

Share this post


Link to post
Share on other sites
Thanks every one for helping. Now I know what actually happen.
I have add a BMP(1.4M) file into the Resources Files folder in c++.net. After removing it my release version is only 35k.

Thank everyone for your advice.

Share this post


Link to post
Share on other sites