安裝 libmysqlc++-dev 時遇到問題

安裝 libmysqlc++-dev 時遇到問題
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++-devUbuntu 中沒有命名的套件。

如果您想要 MySQL C++ 程式庫綁定的開發文件,請安裝該套件libmysql++-dev(不含c)。

答案2

您正在新增不需要clibmysqlc++-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終端

  • 將目前鏡像替換為您新選擇的鏡像

然後安裝該軟體包應該不會出現任何問題。

相關內容