mysql c driver_MySQL C Connector:对`get_driver_instance’的未定义引用

我一直试图让MySQL连接器工作我已经安装了连接器和mysql客户端库,但我仍然收到此错误:

obj/Database.obj: In function `Database::connect()':

/home/xeross/alpine/src/server/Database.cpp:13: undefined reference to `get_driver_instance'

collect2: ld returned 1 exit status

make[2]: *** [alpine-server] Error 1

make[1]: *** [.build-conf] Error 2

make: *** [.build-impl] Error 2

使用Ubuntu 10.04

我的makefile如下:

INCLUDES = -I./src -I./src/shared

OUTDIR = bin

INTDIR = obj

OPTIONS = -ggdb -g3 -Wall -O0

alpine-server : Shared.a AsyncServerSocket.obj PlayerHandler.obj PacketHandler.obj Session.obj User.obj Database.obj init

g++ $(INCLUDES) $(OPTIONS) -static \

-pthread \

-lmysqlcppconn-static \

-o $(OUTDIR)/alpine-server src/server/main.cpp \

$(INTDIR)/AsyncServerSocket.obj \

$(INTDIR)/PacketHandler.obj \

$(INTDIR)/Database.obj \

$(INTDIR)/PlayerHandler.obj \

$(INTDIR)/Session.obj \

$(INTDIR)/User.obj \

$(INTDIR)/Shared.a \

-lboost_system \

-lmysqlclient

AsyncServerSocket.obj : src/server/AsyncServerSocket.cpp init

g++ -c $(INCLUDES) $(OPTIONS) -o $(INTDIR)/AsyncServerSocket.obj src/server/AsyncServerSocket.cpp

PlayerHandler.obj : src/server/PlayerHandler.cpp init

g++ -c $(INCLUDES) $(OPTIONS) -o $(INTDIR)/PlayerHandler.obj src/server/PlayerHandler.cpp

PacketHandler.obj : src/server/PacketHandler.cpp init

g++ -c $(INCLUDES) $(OPTIONS) -o $(INTDIR)/PacketHandler.obj src/server/PacketHandler.cpp

Session.obj : src/server/Session.cpp init

g++ -c $(INCLUDES) $(OPTIONS) -o $(INTDIR)/Session.obj src/server/Session.cpp

User.obj : src/server/User.cpp init

g++ -c $(INCLUDES) $(OPTIONS) -o $(INTDIR)/User.obj src/server/User.cpp

Database.obj : src/server/Database.cpp init

g++ -c $(INCLUDES) $(OPTIONS) -o $(INTDIR)/Database.obj src/server/Database.cpp

# Shared.a

Shared.a : Packet.obj Flags.obj AsyncSocket.obj Log.obj init

ar -cvq $(INTDIR)/Shared.a \

$(INTDIR)/Packet.obj \

$(INTDIR)/Flags.obj \

$(INTDIR)/AsyncSocket.obj \

$(INTDIR)/Log.obj

ranlib $(INTDIR)/Shared.a

Packet.obj : src/shared/packet.cpp init

g++ -c $(INCLUDES) $(OPTIONS) -o $(INTDIR)/Packet.obj src/shared/packet.cpp

Flags.obj : src/shared/Flags.cpp init

g++ -c $(INCLUDES) $(OPTIONS) -o $(INTDIR)/Flags.obj src/shared/Flags.cpp

AsyncSocket.obj : src/shared/AsyncSocket.cpp init

g++ -c $(INCLUDES) $(OPTIONS) -o $(INTDIR)/AsyncSocket.obj src/shared/AsyncSocket.cpp

Log.obj : src/shared/Log.cpp init

g++ -c $(INCLUDES) $(OPTIONS) -o $(INTDIR)/Log.obj src/shared/Log.cpp

init:

mkdir -p bin obj

clean:

rm -f $(INTDIR)/*.obj $(INTDIR)/*.a

代码

// Excerpt from .hpp file

#include

#include

#include

#include

// End excerpt

void Database::connect()

{

std::stringstream connString;

connString << "tcp://";

connString << m_host;

connString << ":";

connString << m_port;

m_driver = get_driver_instance(); // This guy is being a *****

m_conn = m_driver->connect(connString.str(), m_user, m_password);

m_conn->setSchema(m_database);

}

我该怎么做才能解决这个问题?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值