makefile链接mysql库文件路径,将.so和.a库添加到Makefile

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 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gtk-2.0/gdk -I/usr/include/pango-1.0 -I/usr/lib/gtk-2.0/include -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include

INCS=-I/usr/include/freetype2 -I/usr/include/mysql -Iframeworks ${INCS_GTK}

LDLIBS=-lconfig++ -lcxcore -lcv -lGL -lGLU -lglut -lhighgui -lSDL -lftgl -lueye_api -lboost_filesystem -lboost_system -lann -lpthread -lflycapture -lglog -lmysqlpp -lmysqlclient -lunittest++

DEBUG=-g -pg

WARNINGS=-Wall -Wextra -pedantic -Wno-long-long #-O3 -Weffc++

BUILDDIR=build

BINDIR=dist

MAINCXX=${shell find -name '*.cxx'}

TARGETS=${MAINCXX:%.cxx=%}

CXXFLAGS=${DEBUG} ${WARNINGS} ${DEFINES} ${INCS}

LDFLAGS=${DEBUG} ${WARNINGS} ${DEFINES}

include IDEconfigs/Makefile/generic.mk

I want to add the following paths of static libraries to the makefile .

/usr/local/lib/libYARP_OS.a /usr/local/lib/libYARP_sig.a /usr/local/lib/libYARP_math.a /usr/local/lib/libYARP_dev.a /usr/local/lib/libYARP_name.a /usr/local/lib/libYARP_init.a

how do i go about doing this .

解决方案

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_SO 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 command line you would do something like: gcc -o main main.c -L/usr/local/lib/ -lYARP_SO. This should give you an idea.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值