Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22248

How to force static library to include it dependencies?

$
0
0

I build my own static library with gcc and ar like this.

g++ \
    ... list of library sources ... \
    ... a lot of -L -l -I -D options etc... \
    -c \
    && ar crf ./lib/libpackager.a *.o

Then I use this library in my app. Currently I built it like this.

g++ \
    myApp.cpp \
    ... same -L -l -I options as in library ... \
    -L. -lpackager \
    -o myApp

It works, but I am little odd for me that I need to duplicate all -l and -L during building the app. Is it possible include all this library dependencies inside the library. My goal to build app like this.

g++ myApp.cpp -L. -lpackager -o myApp

Viewing all articles
Browse latest Browse all 22248

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>