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
“무릇 물이란 지세를 따라 흐르되 작은 틈도 놓치지 않고 적시니 지혜를 갖춘 자와 같고, 움직이면서 아래로 흘러가니 예를 갖춘 자와 같으며, 어떤 깊은 곳도 머뭇거리지 않고 들어가니 용기를 가진 자와 같고 장애물이 막혀서 갇히면 고요히 맑아지니 천명을 아는 자와 같으며, 험한 곳을 거쳐 멀리 흐르지만 끝내 남을 허물어뜨리는 법이 없으니 덕을 가진 자와 같다. 천지는 이것으로 이루어지고, 만물은 이것으로 살아가며, 나라는 이것으로 안녕을 얻고, 만사는 이것으로 평안해지며, 만물은 이것으로 바르게 되는 것이다. 이것이 지혜로운 자가 물을 좋아하는 이유이다.” (한영, <<한시외전>>)