I am writing a C++ program that uses a lot of data internally. This data is distributed over roughly 5000 source code files. When I run make , all these files compile to object code flawlessly. However, when I want to link everything together into one executable my computer runs out of memory.
Any hints are greatly appreciated.
Compile your code into a static library. Then compile against the library which should include only what you need in the final executable.
If you are working with GCC take a look at the AR options. Static library is an archive which you can combine and extract as needed.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.