Results 1 to 1 of 1
I'm using a makefile with g++ on a fairly light project (about 5-6 files, maybe 800 lines of code right now).
One small function in one small file needs to ...
- 01-01-2009 #1Just Joined!
- Join Date
- Jan 2009
- Posts
- 1
Smart ways to increase linking time in gcc/g++/makefiles?
I'm using a makefile with g++ on a fairly light project (about 5-6 files, maybe 800 lines of code right now).
One small function in one small file needs to use a function linked in from a fairly large library. This caused my compile times to increase from about 3-4 seconds to about 35-40, which is pretty annoying for a side project done for fun. The function is complete, tested, and extremely unlikely to change.
Assuming everything is clean, the compile process runs something like this:
g++ -Wall -g -c -o main.o main.cc
g++ -Wall -g -c -o map.o map.cc
g++ -Wall -g -c -o util.o util.cc
g++ -Wall -g main.o map.o util.o -o start -lsmallLib1 -lsmallLib2 -lHUGELibrary
Obviously, as it currently stands, the HUGELibrary is going to get linked in no matter what, even though its only needed for a single function call in util.cc. Hope this illustrates the problem.
I learned about g++ and make from my university, so know some basics but not much more. What I'm wondering is if there is some way to get this compile/link time down?? Something like making an intermediate building block using util.o and the library that is fairly permanent, and then adding that in?? I feel like this has to be a pretty common problem but I don't know the vocab to express it.


Reply With Quote