0

I'm trying to use the mysql.h library to connect to my database using c++. I included the library in the additional libraries proprierty, however, when I'm trying to run the program, I get the following error:

Error LNK2019 unresolved external symbol _mysql_init@4 referenced in function "private: static bool __cdecl AlarmHandler::pushAlarmToActiveAlarmDB(class std::shared_ptr)" (?pushAlarmToActiveAlarmDB@AlarmHandler@@CA_NV?$shared_ptr@VAlarm@@@std@@@Z) Proiect Colectiv C:\Users\docto\source\repos\Proiect Colectiv\Proiect Colectiv\AlarmHandler.obj 1

For some reason, it might not be building the included library? If so, how can I fix that? Thanks!

Toni Florea
  • 43
  • 1
  • 9
  • Moved it to main, so it's easier to read: LNK2019 unresolved external symbol _mysql_init@4 referenced in function _main – Toni Florea May 03 '20 at 21:32
  • You're going to have to figure it out yourself. Only you can look at your build environment, see how it's configured, and then figure out why it's not linking correctly. You can "fix that" by investing some time in learning how your compiler and operating system works, how it's configured, in order to be able to solve fairly common problems like this one. – Sam Varshavchik May 03 '20 at 21:35
  • ***I included the library in the additional libraries proprierty*** your linker says otherwise. – drescherjm May 03 '20 at 21:37
  • Does this answer your question? [What is an undefined reference/unresolved external symbol error and how do I fix it?](https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – Michael Chourdakis May 03 '20 at 21:38
  • ***it might not be building the included library?*** If you think you don't have the library you need, then what did you add to your additional libraries? This is one part you can check and verify that the file you are linking with actually exists. Although if the library did not exist Visual Studio should tell you it could not open youlibname.lib that you added to your additional libraries – drescherjm May 03 '20 at 21:38
  • I assume this whole question is about using mysql connector. There is a tag for that. – drescherjm May 03 '20 at 21:42

0 Answers0