Niko Vuokko wrote:
Vladimir Prus wrote:
You better avoid calling ld directly, unless you're certified ld guru. Use g++ instead.
Dude, I feel like a massive idiot right now. At first I had tried to use g++ like:
g++ <objs> -Wl,-Bstatic,-libboost_regex-s,... -o prog
but it didn't work out
because I *think* you'd need two -Wl options to achieve that effect.
so I tried to give the commands straight to ld. I picked up that -Wl,-Bstatic from some group. I was just amazed that none of the programming courses I've been to have ever said half a word about linking and all its possibilities.
I now tried to dump that -Wl,-Bstatic because it gets sent to ld:
g++ <objs> -llibboost_regex-s ... -o prog
and it just worked. Thanks for that ld -> g++ tip, I'm just embarrassed I didn't try that earlier.
By the way, do you know any good books or sites where I could read about object file structures, linking and all that? Something more extensive than just a short tutorial would be nice. (Yes, it's offtopic, but you're probably reading this anyway and seem to know these things.)
I'm afraid I don't know. On Unix, object files are in ELF format, and you can read about it in System V ABI document: http://www.sco.com/developers/gabi/2003-12-17/contents.html but it's not an introduction document, and is not oriented at end users, more at folks who have a need to directly work with object files. - Volodya
niko