Add .so and .a libraries to Makefile

后端 未结 4 1610
南旧
南旧 2021-02-02 00:01

I have a makefile which looks like this .

DEFINES=-std=c++0x
INCS_GTK=-I/usr/include/gtk-2.0 -I/usr/include/glib-2.0 -I/usr/include/atk-1.0 -I/usr/include/cairo         


        
4条回答
  •  孤城傲影
    2021-02-02 00:19

    Lets consider your /usr/local/lib/libYARP_OS.a.

    What you can do is, have -L/usr/local/lib/ in your makefile as one of the variables. And then you can have -lYARP_OS appended to the LDLIBS.

    -L is for path to the lib and -l is the lib name here libYARP_OS.a will be passed as -lYARP_OS.

    On the command line you would do something like: gcc -o main main.c -L/usr/local/lib/ -lYARP_OS. This should give you an idea.

提交回复
热议问题