...
error LNK2019: unresolved external symbol _mysql_server_init@12 referenced in function "public: static void __cdecl MySQL::Library_Init(void)" (?Library_Init@MySQL@@SAXXZ)
error LNK2001: unresolved external symbol _mysql_free_result@4
fatal error LNK1120: 43 unresolved externals
... (other similar errors)
Solution
...
This error occurs when linking against the wrong libmysql.lib.
| Panel |
|---|
|
- Download MySQL development files
- Packed by us for ease of use however you can use your own MySQL Server install to get libmysql.lib.
- Un-zip mysql_lib.zip to a known location, e.g C:/mysql_lib
- In the CMake GUI tick the Advanced and Group check-boxes.
Image Added - Change MYSQL_LIBRARY to "
C:/mysql_lib/lib_XX/libmysql.lib" as shown below.- XX is 32 if you are compiling in 32 bits mode (i.e Generator is "Visual Studio 12 2013")
- or 64 if you are compiling in 64 bits mode (i.e Generator is "Visual Studio 12 2013 Win64")
- Change MYSQL_INCLUDE_DIR to "
C:/mysql_lib/include" as shown below. - Press Configure and then Generate.
Image Added
|
Related articles
| Filter by label |
|---|
| showLabels | false |
|---|
| max | 5 |
|---|
| spaces | tc |
|---|
| sort | modified |
|---|
| showSpace | false |
|---|
| reverse | true |
|---|
| type | page |
|---|
| labels | windows error LNK2019 visualstudio mysql libmysql |
|---|
|
...