I want to know how I can use the static library in C ++ that I created, first lib:
.
// code: foo.cpp
then I will compile the library first:
- g ++ foo.cpp
- ar rc libfoo.a foo.o
Now I want to use this library in some kind of file, for example:
// prog.cpp
how should i compile them now? I did:
g++ -L. -lfoo prog.cpp
but get an error because the foo function will not be found
source share