Jump to content
Nytro

Building small exe in VC++ 2010

Recommended Posts

Posted

Building small exe in VC++ 2010

li0n.coder

hi all

this is my first post at this amazing forum

in this tutorial i will guide you step by step to make smallest possible native win32 application by using Visual C++ 2010 Express

the reason for this tutorial is that VS 6.0 is very old but most people still use it because it makes small native exe

also most projects were made by VS 6.0 so it is hard for some to convert it to the new edition of VS

1- download and install Visual C++ 2010 Express (free)

2- File>New>project

3- choose win32 project , let us name it smallexe, then press ok

4- new windows will pop up, click next

5- check empty project then click finish

6- go to project>add new item>c++ file> let us name it main , then press ok

7- paste this code which show simple message box

#include <windows.h>


int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
MessageBoxA(NULL,"my small exe!","info",0);
return 0;
}

8- now go to project>properties

9- press configuration manger and set active solution configuration to "release" then close

10- [optional step] many codes around will generate errors when you build it , simply because they were written in VS 6.0 and they don't support Unicode, if you don't know how to convert the project to Unicode we can disable this feature

configuration properties>character set>change to "not set"

11- go to C/C++>optimization>optimization>choose minimize size

12- go to C/C++>code generation>run time library>choose multi threaded dll (/MT)

why ? this option will Remove dependency of msvcr100.dll which is not available natively on windows xp

13-go to linker>manifest file>generate manifest>choose no

14-go to linker>debugging>generate debug info>choose no

15-go to linker>advanced>entry point> write WinMain

16- build the project

yaaaay 2.5kb app, that run without any dependency !!

when you write bigger project use minicrt.lib[download from attachments], it also will decrease the size

linker>input>additional dependencies> write minicrt.lib;

hope it works with you guys

Sursa: ic0de.org

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...