N
N
Nerd0_02019-05-01 12:07:23
C++ / C#
Nerd0_0, 2019-05-01 12:07:23

How to connect mariadb in c++?

I'm trying to connect mariadb to a C++ program. mysql.h is in /usr/include/mariadb, libmariadb.so is in /usr/lib/mysql/lib/mariadb, installed from the repository named libmariadb3 and libmariadb-dev.
The program contains the #inclide command, which is always scolded like this:

/usr/bin/ld: cannot find -lmysql.h
clang: error: linker command failed with exit code 1 (use -v to see invocation)
CMakeFiles/mysql_debug.dir/build.make:94: recipe for target 'mysql_debug' failed
make[2]: *** [mysql_debug] Error 1
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/mysql_debug.dir/all' failed
make[1]: *** [CMakeFiles/mysql_debug.dir/all] Error 2
Makefile:94: recipe for target 'all' failed
make: *** [all] Error 2

How to link the library correctly? It seems to me that I do not see something simple.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Ananiev, 2019-05-01
@Nerd0_0

Apparently -lmariadb should be instead of -lmysql.h

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question