Help on creating basic Mysql connection
Added by marco di antonio over 3 years ago
Hi, this is my first time using Wt++.
I compiled latest 4.5 from source and all went fine. Cmake found the Mysql headers so DBO mysql got compiled too (ubuntu 16.04).
This is what Im doing:
Wt::Dbo::backend::MySQL *pBackend;
pBackend = new Wt::Dbo::backend::MySQL::("mydbname","root","mypass","localhost", 3306,"",-1);
Compiler crashes:
g++ -std=c++14 -o hello.wt hello.C -lwthttp -lwt ;
/tmp/ccVeA9ih.o: In function HelloApplication::HelloApplication(Wt::WEnvironment const&)':
Wt::Dbo::backend::MySQL::MySQL(std::cxx11::basic_string, std::allocator > const&, std::cxx11::basic_string, std::allocator > const&, std::cxx11::basic_string, std::allocator > const&, std::cxx11::basic_string, std::allocator >, unsigned int, std::__cxx11::basic_string, std::allocator > const&, int)'
hello.C:(.text+0x707): undefined reference to
collect2: error: ld returned 1 exit status
Do I need to pass some parameter to compiler g++ command ???
Thanks so much
Replies (1)
RE: Help on creating basic Mysql connection - Added by marco di antonio over 3 years ago
It seems I had to add -lwtdbomysql to the g++ command to make this work... great!