how to reduce size in c++?

mc 4,026 Reputation points
2024-06-22T02:38:27.61+00:00

I used just one func in lib.

but if I do not use this func the size may be 30kb

if I use it is 150kb

but I just use one not all.

the .h file is very big. 331kb

how to reduce unused codes?

I am creating dll

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,612 questions
0 comments No comments
{count} votes

Accepted answer
  1. RLWA32 42,476 Reputation points
    2024-06-22T07:15:31.7+00:00

    First of all, the size of a header file is unrelated to the size of a binary (.exe or .dll) that uses a function declared in the header file.

    A debug build will produce a binary that is larger than one produced by a release build. The default linker options for a release build include an option to remove unreferenced code and data from the generated binary.

    A binary that uses load-time (static) linkage to the CRT will be larger than one that uses run-time (dynamic) linkage.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful