How to link object file (*.o) and static library file (*.a)
I have 2 object files (*.o
) and one static library (*.a
) using g++
How to link these files and become 1 开发者_JAVA技巧object file (*.o
)?
Please advice…thanks.
This is one (rare) case where you shouldn't be using g++
. Use ld
directly:
ld -r -o combined.o foo.o bar.o libxyz.a
精彩评论