Gcc .a and .o Files

I have two precompiled libraries: X.aand Y.a, and the source code test.cpp (without the main function) uses these two libraries.

I compiled C ++ using:

g++ -c test.cpp

and I got 'test.o'.

Now, how can I link these three together to generate a file .abecause test.cpp uses some function in Xa and Ya and other GCC libraries?

By the way, I am doing this under Windows using MinGW. Can I rename this .a file to .lib and use this .lib in VC?

Thank!

+3
source share
2 answers

, .a, test.cpp X.a Y.a GCC?

.a - ar , (.o files)

.a .lib .lib VC?

, . : http://opensees.berkeley.edu/community/viewtopic.php?t=2267

+5

, :

ar rcs X.a test.o

X.a Y.a, , X Y, , !

, main!

EDIT: this.

+3

Source: https://habr.com/ru/post/1747655/


All Articles