The better solution is to tell the compiler not to link to the CRT in the first place. To do that make the following changes in the project settings:
- C/C++ | Code Generation - Disable "Basic Runtime Checks." Anything that adds /RTCx to the command line must be removed.
- C/C++ | Code Generation - Disable "Buffer Security Check," i.e. add /GS- option.
- Linker | Input - Change "Ignore All Default Libraries" to Yes.
- Linker | Advanced - Set the "Entry Point" to "wmain"
- Finally in your code, create the entry point "int __stdcall wmain(void)"
This should allow you to compile and link without the CRT. You can create some incredibly small executables this way. However be aware this is best suited for simple apps. Anything more complex, like apps that link to MFC, this technique won't work as most other libraries and DLLs require the CRT.
No comments:
Post a Comment