0

I have visual studio 10 and mysql workbench installed.I have created a new win32 console application project and to include the files done the following:

in project properties under c/c++ -> general, I have added C:\Program Files\MySQL\MySQL Server 5.6\include

in linker -> general -> additional library directories I have added C:\Program Files\MySQL\MySQL Server 5.6\lib

in linker -> general -> input -> additional dependencies I have added libmysql.lib

i have copied libmysql.lib to system32 folder.

#include<iostream>
#include<my_global.h>
#include<mysql.h>
MYSQL* con=mysql_init(NULL);
MYSQL_RES* result;

the above code gives the following error->

error LNK2019: unresolved external symbol _mysql_init@4 referenced in function "void __cdecl `dynamic initializer for 'con''(void)" (??__Econ@@YAXXZ)
1>c:\users\dell\documents\visual studio 2010\Projects\dmrc2\Debug\dmrc2.exe : fatal error LNK1120: 1 unresolved externals
user3819404
  • 611
  • 6
  • 18

2 Answers2

0

unresolved external symbol this is linker error. In other words, your code is OK to compile but is not correct when attempting to link library into an executable because you input wrong library file name.

You need input library name instead of dll name.
In linker -> general -> input -> additional dependencies I have added libmysql.lib

Jerry YY Rain
  • 4,134
  • 7
  • 35
  • 52
0

place your libmysql.lib file in debug folder which is located in your project directory