aanchal@aanchal-Inspiron-3542:~$ sudo apt-get install libmysqlc++-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libmysqlc++-dev
E: Couldn't find any package by regex 'libmysqlc++-dev'
'universe'选项在软件中心已启用。
好吧,谢谢大家,我输入了错误的命令。它已成功安装。然后我尝试运行程序 test.cpp:
#include <iostream>
#include <mysql.h>
using namespace std;
MYSQL *connection, mysql;
MYSQL_RES *result;
MYSQL_ROW row;
int query_state;
int main() {
return 0;
}
使用以下命令:
g++ -o test test.cpp -L/usr/include/mysql -lmysqlclient -I/usr/include/mysql
它没有给我任何错误消息。那么这是否意味着一切正常?
答案1
libmysqlc++-dev
Ubuntu 中没有命名的软件包。
如果您想要 MySQL C++ 库绑定的开发文件,请安装该包libmysql++-dev
(不带c
)。
答案2
c
您正在添加不需要的libmysqlc++-dev
。它应该是libmysql++-dev
。
sudo aptitude show libmysql++-dev
Package: libmysql++-dev
State: not installed
Version: 3.2.1+pristine-1
Priority: optional
Section: universe/libdevel
Maintainer: Ubuntu Developers <[email protected]>
Architecture: i386
Uncompressed Size: 2,350 k
Depends: libmysql++3 (= 3.2.1+pristine-1), libmysqlclient-dev
Suggests: libmysql++-doc
Description: MySQL C++ library bindings (development)
MySQL++ is a complex C++ API for MySQL (and other SQL databases soon). The goal of this API is to make working with Queries as easy as
working with other STL containers.
安装libmysql++-dev
sudo apt-get install libmysql++-dev
答案3
该包裹libmysql++-dev
不包含c
。
如果在安装上述内容时遇到同样的错误,则需要更改存档镜像:
选择一个这里,确保它靠近您的位置。
进入
gksudo gedit /etc/apt/sources.list
终端用新选择的镜子替换当前镜子
然后软件包就可以顺利安装。