I have a C++ program that needs to connect to a database, but when I go to compile the code, it gives me errors that have to do with the mysql++ library. This is the error:
/tmp/ccBR3q67.o: In function `main':
main.cpp:(.text+0x1e1): undefined reference to `mysqlpp::Connection::Connection(bool)'
main.cpp:(.text+0x20b): undefined reference to `mysqlpp::Connection::connect(char const*, char const*, char const*, char const*, unsigned int)'
main.cpp:(.text+0x229): undefined reference to `mysqlpp::Connection::query(char const*)'
main.cpp:(.text+0x282): undefined reference to `mysqlpp::SQLTypeAdapter::SQLTypeAdapter(std::string const&, bool)'
main.cpp:(.text+0x2b5): undefined reference to `mysqlpp::operator<<(mysqlpp::quote_type1, mysqlpp::SQLTypeAdapter const&)'
main.cpp:(.text+0x2dd): undefined reference to `mysqlpp::Query::execute()'
main.cpp:(.text+0x305): undefined reference to `mysqlpp::Query::store()'
main.cpp:(.text+0x40a): undefined reference to `mysqlpp::Connection::~Connection()'
main.cpp:(.text+0x52e): undefined reference to `mysqlpp::Connection::~Connection()'
collect2: error: ld returned 1 exit status
This is the compile command:
g++ -std=c++11 -I /usr/local/include/mysql++ -I /usr/include/mysql/ -L/usr/lib/mysql -L/usr/local/lib -lmysqlclient -lmysqlpp main.cpp
AFAIK this should work properly, and I don't see any solutions on google as to why it isn't working.
This is not a duplicate of an existing question, and is certainly not an exact duplicate. I am one hundred percent sure that this exact question was not answered on the linked question.