MySQL Forums
Forum List  »  Connector/C++

Re: Static linking to Connector/C++ on linux giving errors
Posted by: Pelle Stormark
Date: April 13, 2020 07:28AM

I am using Elementary OS 5.1.3 (Built on Ubuntu 18.04.3).
The compiler is GCC 7.5.0.

I tried the first compiler line:

g++ main.cc -o test -I /usr/include/mysql-cppconn-8/include /usr/include/mysql-cppconn-8/lib64/libmysqlcppconn8-static.a -lssl -lcrypto -lpthread -lresolv

I had to change the paths, but otherwise identical. It gave me:

/tmp/ccug6Qs4.o: In function `mysqlx::abi2::r0::string::traits<char>::to_str[abi:cxx11](mysqlx::abi2::r0::string const&)':
main.cc:(.text._ZN6mysqlx4abi22r06string6traitsIcE6to_strB5cxx11ERKS2_[_ZN6mysqlx4abi22r06string6traitsIcE6to_strB5cxx11ERKS2_]+0x2e): undefined reference to `mysqlx::abi2::r0::string::Impl::to_utf8[abi:cxx11](mysqlx::abi2::r0::string const&)'
collect2: error: ld returned 1 exit status

I tried the second line:

g++ main.cc -o test -I /usr/include/mysql-cppconn-8/include -lmysqlcppconn8 -lssl -lcrypto -lpthread -lresolv

It gave me:
/usr/bin/ld: cannot find -lmysqlcppconn8
collect2: error: ld returned 1 exit status

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Static linking to Connector/C++ on linux giving errors
233
April 13, 2020 07:28AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.