[CONC-337] undefined reference to `mysql_init' Created: 2018-05-31  Updated: 2018-06-01  Resolved: 2018-06-01

Status: Closed
Project: MariaDB Connector/C
Component/s: None
Affects Version/s: 3.0.4
Fix Version/s: N/A

Type: Bug Priority: Blocker
Reporter: Juan Gonzalez Assignee: Georg Richter
Resolution: Not a Bug Votes: 0
Labels: reference, undefined
Environment:

ubuntu linux


Issue Links:
Blocks
blocks CONC-23 Undefined references while trying to ... Open

 Description   

how to compile and link the connector.
i have compiled and sudo make install successfully.

I get a reference error
SOURCE: main.cpp

#include <mysql.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main(int argc, char *argv[])

{ MYSQL *mysql; const char *query; MYSQL_RES *result; mysql= mysql_init(NULL); }

COMPILE:
gcc main.cpp -o main -I/usr/local/include/mariadb
-L/usr/local/lib/mariadb/libmariadb -L/usr/local/lib/mariadb/libmariadbclient

/tmp/cczVzenH.o: In function `main':
main.cpp.text+0x15): undefined reference to `mysql_init'
collect2: error: ld returned 1 exit status



 Comments   
Comment by Georg Richter [ 2018-06-01 ]

Please check the output of

mariadb_config --libs

for correct linker options.

Comment by Juan Gonzalez [ 2018-06-01 ]

this solve my problem.
thanks a lot Georg.

Saludos
Juan.

Generated at Thu Feb 08 03:04:35 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.