#1 Le 08/01/2017, à 18:56
- grigouille
[résolu] impossible de linker un client mysql
Bonjour,
Je n'arrive pas à linker ce code :
$ apt-cache policy libmysqlclient-dev | head -n 2
libmysqlclient-dev:
Installé : 5.7.16-0ubuntu0.16.04.1
$ cat toto.cpp
#include <mysql.h>
int main()
{
MYSQL *mysql = mysql_init(0);
mysql_close(mysql);
return 0;
}
$ g++ -o toto $(mysql_config --cxxflags --libs) toto.cpp
/tmp/cc7MhWY1.o : Dans la fonction « main » :
toto.cpp:(.text+0xe) : référence indéfinie vers « mysql_init »
toto.cpp:(.text+0x1e) : référence indéfinie vers « mysql_close »
collect2: error: ld returned 1 exit status
$
Merci pour votre aide.
Dernière modification par grigouille (Le 08/01/2017, à 20:50)
Debian (xfce) 12
HP LaserJet M1132 MFP
Hors ligne
#2 Le 08/01/2017, à 19:10
- pingouinux
Re : [résolu] impossible de linker un client mysql
Bonsoir,
Sans garantie, essaye d'inverser la fin de la ligne
g++ -o toto toto.cpp $(mysql_config --cxxflags --libs)
Hors ligne
#3 Le 08/01/2017, à 20:49
- grigouille
Re : [résolu] impossible de linker un client mysql
Fixed !
Merci pingouinux.
Debian (xfce) 12
HP LaserJet M1132 MFP
Hors ligne