Visual Basic, C & C++
분류 C & C++

Dev C++ 실행파일 용량 줄이기

페이지 정보

본문

You could blame the C++ headers and libraries for being a bit on the fat side, but complaints like that aside, there are quite a few ways to fix this:

  • You can remove any unused header information from exes using the -s command. It can be found under Tools >> Compiler Options >> Settings >> Linker for non-project compilations and Project >> Project Options >> Compiler >> Linker for project compilations. This is the most effective measure. Beware that debugging information is stripped too, so you won't be able to debug your program.
  • Using C headers instead of C++ ones will help a great deal too, but I understand that's usually not an option.
  • You can tell the compiler to optimize the assembly for size, by using -Os. Please check the 'Optimization Level' option for this.
  • You can decide to dynamically link library data by removing '-static-libgcc' and the other -static flag from Tools >> Compiler Options >> General. This will shrink the exe, but you will be forced to provide DLLs when you need to run your exes.

I hope I could be of help.

----------------------------------------------------------

https://sourceforge.net/p/orwelldevcpp/forums/compiling/thread/a4ca8874/ 


C++ 헤더와 라이브러리가 약간 뚱뚱하다고 비난할 수 있지만, 그런 불만은 제쳐두고 이 문제를 해결할 수 있는 몇 가지 방법이 있습니다.

  • -s 명령을 사용하여 exe에서 사용하지 않는 헤더 정보를 제거할 수 있습니다. 비프로젝트 컴파일의 경우 도구 >> 컴파일러 옵션 >> 설정 >> 링커, 프로젝트 컴파일의 경우 프로젝트 >> 프로젝트 옵션 >> 컴파일러 >> 링커에서 찾을 수 있습니다. 이것은 가장 효과적인 조치입니다. 디버깅 정보도 제거되므로 프로그램을 디버깅할 수 없습니다.
  • C++ 헤더 대신 C 헤더를 사용하는 것도 많은 도움이 될 것이지만 일반적으로 선택 사항이 아니라는 것을 알고 있습니다.
  • -Os를 사용하여 크기에 맞게 어셈블리를 최적화하도록 컴파일러에 지시할 수 있습니다. 이를 위해 '최적화 수준' 옵션을 확인하십시오.
  • 도구 >> 컴파일러 옵션 >> 일반에서 '-static-libgcc' 및 기타 -static 플래그를 제거하여 라이브러리 데이터를 동적으로 연결하도록 결정할 수 있습니다. 이렇게 하면 exe가 축소되지만 exe를 실행해야 할 때 DLL을 제공해야 합니다.

도움이 될 수 있기를 바랍니다.


관련자료

등록된 댓글이 없습니다.
프로그래밍
Today's proverb
우리 시대에 가장 암울한 말이 있다면 "남 하는 대로" "나 하나쯤이야" "세상이 그런데". 우리 시대에 남은 희망이 있다면 "나 하나만이라도" "내가 있음으로 " "내가 먼저". (박노해)