Reputation: 466
I am trying to run sample program for mysql c++ connect. each time getting error. Here are various way I tried from various solutions with no luck.
Any help will be highly appreciated!
g++ -o a temp.cpp -lmysqlcppconn // error : many error like /usr/lib/gcc/i686-linux-gnu/4.7/../../../../lib/libmysqlcppconn.so: undefined reference to `mysql_next_result@libmysqlclient_18'
g++ -o test -Iinclude -Llib -L/usr/lib64/mysql -lmysqlclient temp.cpp // error: /usr/bin/ld: cannot find -lmysqlclient
g++ -Wall -o firsttry_prog -I/usr/include/mysqlcppconn -L/usr/lib/mysqlcppconn temp.cpp -lmysqlcppconn // ERRor : kind of dozens error : /usr/lib/gcc/i686-linux-gnu/4.7/../../../../lib/libmysqlcppconn.so: undefined reference to `mysql_stmt_field_count@libmysqlclient_18'
sudo g++ -Wall -I/usr/include/cppconn -o testapp temp.cpp -L/usr/lib -lmysqlcppconn //gives dozens of error
Upvotes: 0
Views: 504
Reputation: 246
Looks like you don't have the mysqlclient lib installed.
Try this if you made sure you installed it:
g++ -o temp.o -c `mysql_config --cflags` temp.cpp
g++ -o temp temp.o -lmysqlcppconn `mysql_config --libs`
see MySQL - Building C API Client Programs
Upvotes: 1