提问人:Blacktempel 提问时间:2/27/2014 更新时间:2/27/2014 访问量:340
LNK2019 - 未解析的外部 - C++ 和 MySQL
LNK2019 - Unresolved External - C++ & MySQL
问:
我已经下载并安装了MySQL - 完整版 - 正确包含所有标头(VC ++目录),在System32中复制了.dll,并为链接器提供了库目录和库。
#include "stdafx.h"
#include "my_global.h"
#include "mysql.h"
#include <iostream>
int _tmain (int argc, _TCHAR* argv[])
{
MYSQL *my;
my = mysql_init (NULL);
if (!my)
return EXIT_FAILURE;
if (!mysql_real_connect (my, "localhost", "root", "Test", "testing", 3307, NULL, 0))
//Print error...
mysql_close (my);
return EXIT_SUCCESS;
}
尽管一切正常,但它仍然会给我带来链接器错误......
1>MYSQL_Connection.obj : error LNK2019: unresolved external symbol _mysql_close@4 referenced in function _wmain
1>MYSQL_Connection.obj : error LNK2019: unresolved external symbol _mysql_errno@4 referenced in function _wmain
1>MYSQL_Connection.obj : error LNK2019: unresolved external symbol _mysql_error@4 referenced in function _wmain
1>MYSQL_Connection.obj : error LNK2019: unresolved external symbol _mysql_real_connect@32 referenced in function _wmain
1>MYSQL_Connection.obj : error LNK2019: unresolved external symbol _mysql_init@4 referenced in function _wmain
1>C:\Users\USERNAME\Documents\Visual Studio 2010\Projects\C++_SQL_Testing\Debug\MYSQL_Connection.exe : fatal error LNK1120: 5 unresolved externals
我在互联网上遇到了不同的“解决方案”,并尝试了它们,但没有成功。有人还提到了 32 位和 64 位的问题。这对我来说甚至不应该存在,因为MySQL在他们的网站上声明了这一点:
Note: MySQL Installer is 32 bit, but will install both 32 bit and 64 bit binaries.
有谁知道可能出了什么问题?
答: 暂无答案
评论