Closed s111tend closed 1 year ago
I'm not a Windows user, so I can't help much. I think that your build system might be missing linking with some system library here or you are using the wrong version of Windows. At least that what it means when the linker ("ld" in your error message) doesn't find a symbol ("WSAPoll") anywhere.
Interesting error, WSAGetLastError is implemented by Ws2_32
library on Windows. Need to add it to target_link_libraries
.
Just provided a hotfix here: https://github.com/taocpp/taopq/pull/65
@s111tend Meanwhile, please, add Ws2_32
to your libraries list to be linked.
@uilianries, thank you so much! It works! I have some deadlines for this work and you are very timely with your answer! Thanks a lot! Should i close this issue if there is already a solution?
@uilianries Thank you!
Hello everyone! I've got a problem while using this library. It may not even be related to it, but i hope, you can help me. While trying to connect to the database I get an error.
in function
tao::pq::connection::wait(bool, std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long long, std::ratio<1ll, 1000000000ll> > >)': .../connection.cpp:271: undefined reference to 'WSAPoll' .../connection.cpp:293: undefined reference to '__imp_WSAGetLastError' collect2.exe: error: ld returned 1 exit status`(connection.cpp is a file of this library after building. Route: cmake-build-debug/_deps/taocpp-taopq-src/src/lib/pq/connection.cpp)
A part of my test code that interacts with db is only dbConnect() function yet. It has no try-catch blocks but i think it doesn't matter. This part of code i took from the docs of this library.
void dbConnect () { const auto conn = tao::pq::connection::create(DB_URL); // DB_URL is a const of a std::string type that contains a url of real database that i have access to const auto users = conn->execute( "SELECT * FROM users"); for( const auto& row : users ) { std::cout << row[ "username" ].as< std::string >() << " is " << row[ "name" ].as< std::string >() << "\n"; } }
I've also tried to insert into a connection string something like "host=... db=... ....", but I always catch the same error(
I googled what is the problem, but i cant find answers. Maybe you know how to solve it. I hope, you can help me. Thanks!