Strona 1 z 1

instalacja bibioteki sql do c++

: 03 lip 2011, 18:44
autor: sentrio
Mam następujący problem. Nie mogę zainstalować bibioteki (mysqlwrapper - http://www.alhem.net/project/mysql/ ) i skompilować żadnego programu. Jak wypakuję pliki i daję polecenie w terminalu - make, sypią się błęsy

Kod: Zaznacz cały

ucjan@lucjan-laptop:~/Pulpit/mysqlwrapped-1.6.1$ make
g++  -Wall -g -O2 -I/usr/devel/include  -MD  -c -o Database.o Database.cpp
Database.cpp:46:25: error: mysql/mysql.h: Nie ma takiego pliku ani katalogu
In file included from Database.cpp:51:
Database.h:92: error: ‘MYSQL’ does not name a type
Database.cpp: In destructor ‘virtual Database::~Database()’:
Database.cpp:110: error: ‘struct Database::OPENDB’ has no member named ‘mysql’
Database.cpp:110: error: ‘mysql_close’ was not declared in this scope
Database.cpp: In member function ‘virtual void Database::OnMyInit(Database::OPENDB*)’:
Database.cpp:131: error: ‘struct Database::OPENDB’ has no member named ‘mysql’
Database.cpp:131: error: ‘MYSQL_READ_DEFAULT_GROUP’ was not declared in this scope
Database.cpp:131: error: ‘mysql_options’ was not declared in this scope
Database.cpp: In member function ‘Database::OPENDB* Database::grabdb()’:
Database.cpp:167: error: ‘struct Database::OPENDB’ has no member named ‘mysql’
Database.cpp:167: error: ‘mysql_init’ was not declared in this scope
Database.cpp:177: error: ‘struct Database::OPENDB’ has no member named ‘mysql’
Database.cpp:177: error: ‘mysql_real_connect’ was not declared in this scope
Database.cpp:186: error: ‘struct Database::OPENDB’ has no member named ‘mysql’
Database.cpp:186: error: ‘mysql_real_connect’ was not declared in this scope
Database.cpp:198: error: ‘struct Database::OPENDB’ has no member named ‘mysql’
Database.cpp:198: error: ‘mysql_ping’ was not declared in this scope
Database.cpp: In member function ‘bool Database::Connected()’:
Database.cpp:261: error: ‘struct Database::OPENDB’ has no member named ‘mysql’
Database.cpp:261: error: ‘mysql_ping’ was not declared in this scope
make: *** [Database.o] Błąd 1
proszę o pomoc, może ktoś miał już podobny problem

Re: instalacja bibioteki sql do c++

: 03 lip 2011, 19:06
autor: norvoles
Database.cpp:46:25: error: mysql/mysql.h: Nie ma takiego pliku ani katalogu
Nie ma tego pliku nagłówkowego. Jakoś autor nie napisał skąd go wziąć, więc pewnie jest to jakiś nagłówek ze źródeł MySQL

Re: instalacja bibioteki sql do c++

: 03 lip 2011, 22:42
autor: sentrio
Dla pewności zainstalowałem cały zestaw PHP mysql apache ale i to nic nie pomogło. Jakieś pomysły?

edit : Przyda się napewno komuś w przyszłości. Trzeba doinstalować pakiet "libmysqlclient-dev" (apt-get install libmysqlclient-dev ). W nim jest biblioteka mysql.h. Dobra teraz schodów zrobiło się trochę mniej tzn bibliotekę mam tylko jak daje znowu "make" to kompiltor nie może znaleźć definicji funkcji strcpy z ansi c.

Kod: Zaznacz cały

lucjan@lucjan-laptop:~/Pulpit/mysqlwrapped-1.6.1$ make
g++  -Wall -g -O2 -I/usr/devel/include  -MD  -c -o Database.o Database.cpp
g++  -Wall -g -O2 -I/usr/devel/include  -MD  -c -o Query.o Query.cpp
g++  -Wall -g -O2 -I/usr/devel/include  -MD  -c -o StderrLog.o StderrLog.cpp
g++  -Wall -g -O2 -I/usr/devel/include  -MD  -c -o SysLog.o SysLog.cpp
SysLog.cpp: In constructor ‘SysLog::SysLog(const std::string&, int, int)’:
SysLog.cpp:51: error: ‘strcpy’ was not declared in this scope
make: *** [SysLog.o] Błąd 1
Próbowałem do tego pliku dodać iostream i stdio ale moje kombinacje nic nie dały. Ten problem bardziej doświadczeni chyba rozwiążą.

-- 04 lip 2011 12:40 --

trochę się doedukowałem i uparłem na inną bibliotekę ale wystarczy sam mysql.h
tu daję kilka linków - może komuś się przyda
http://zetcode.com/tutorials/mysqlcapitutorial/
http://www.kitek.pl/2008/03/06/mysql-ap ... c-czesc-1/

Re: instalacja bibioteki sql do c++

: 04 lip 2011, 19:05
autor: luzakwielki
sentrio pisze: Próbowałem do tego pliku dodać iostream i stdio ale moje kombinacje nic nie dały.
Nie powinno to specjalnie dziwić, bo funkcja strcpy jak i większość zaczynających się od "str" w bibliotece standardowej języka C są w nagłówki "string.h", lub "cstring" w kompilatorach C++.