Windows 窗体应用程序中的链接器错误

发布于 2024-12-17 05:26:35 字数 7526 浏览 1 评论 0原文

我正在尝试制作我的第一个 Windows 窗体应用程序。我正在尝试建立 SQL 连接,因此我插入了 SQL 函数,该函数在控制台应用程序中完美运行。我重写了一点,但现在,我收到链接器错误,我不知道为什么。

有人可以帮助我,我做错了什么吗?

谢谢!

错误:

错误 3 错误 LNK2028:无法解析的标记 (0A000023)“extern "C"短 __stdcall SQLGetData(void *,unsigned Short,short,void *,long,long *)" (?SQLGetData@@$$J224YGFPAXGF0JPAJ@ Z) 在函数“private: bool __clrcall”中引用Test_WindowsForm::Form1::ExecuteSQLCommand(void)" (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

错误 4 错误 LNK2028:无法解析的令牌 (0A000024) "extern "C “短 __stdcall SQLFetch(void *)” (?SQLFetch@@$$J14YGFPAX@Z)在函数“private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)”中引用 (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

错误 5 错误 LNK2028:未解决标记(0A000025)“extern“C”短__stdcall SQLRowCount(void *,long *)” (?SQLRowCount@@$$J18YGFPAXPAJ@Z) 在函数“private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)”中引用 (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

<代码>错误 6 错误 LNK2028:无法解析的令牌 (0A000026)“extern函数“private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)”(?ExecuteSQLCommand@Form1@ Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

错误 7 错误LNK2028:未解析的标记(0A000027)“extern“C”短__stdcall SQLDisconnect(void *)”(?SQLDisconnect@@$$J14YGFPAX@Z)在函数“private:bool __clrcall Test_WindowsForm :: Form1 :: ExecuteSQLCommand(void)”中引用(?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

错误 8 错误 LNK2028:无法解析的令牌 (0A000028) “extern “C”短 __stdcall SQLFreeHandle(short,void *)” (?SQLFreeHandle@@$$J18YGFFPAX@Z) 在函数中引用”私有: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

错误 9 错误 LNK2028: 无法解析的令牌 (0A000029) "extern "C" 短 __stdcall SQLExecDirectA(void *,unsigned char * ,长)" (?SQLExecDirectA@@$$J212YGFPAPAEJ@Z)在函数“private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)”中引用 (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

错误 10 错误 LNK2028:未解决标记 (0A00002A)“extern “C”短 __stdcall SQLSetStmtAttrW(void *,long,void *,long)" (?SQLSetStmtAttrW@@$$J216YGFPAXJ0J@Z) 在函数“private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)”中引用 (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$ $FA$AAM_NXZ) Test_WindowsForm.obj

错误 11 错误 LNK2028:未解析的标记(0A00002B)“extern“C”短__stdcall SQLDriverConnectA(void *,struct HWND__ *,无符号字符*,短,无符号字符*,短,短*,无符号短)”(?SQLDriverConnectA@@$$J232YGFPAXPAUHWND__@@ PAEF2FPAFG@Z) 在函数“private: bool __clrcall”中引用Test_WindowsForm::Form1::ExecuteSQLCommand(void)" (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

错误 12 错误 LNK2028:无法解析的令牌 (0A00002C) "extern "C “短 __stdcall SQLSetConnectAttrW(void *,long,void *,long)” (?SQLSetConnectAttrW@@$$J216YGFPAXJ0J@Z) 在函数“private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)”中引用 (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

<代码>错误 13 错误 LNK2028:无法解析的令牌(0A00002D)“extern“C”短__stdcall SQLSetEnvAttr(void *,long,void *,long)”(?SQLSetEnvAttr@@$$J216YGFPAXJ0J@Z)在函数“private:bool __clrcall Test_WindowsForm :: Form1 :: ExecuteSQLCommand(空白)” (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

错误 14 错误 LNK2028: 无法解析的令牌 (0A00002E) "extern "C" 短 __stdcall SQLAllocHandle(short,void *,void * *)" (?SQLAllocHandle@@$$J212YGFFPAXPAPAX@Z) 在函数“private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)”中引用 (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

<代码>错误 15 错误 LNK2019:无法解析的外部符号“extern”C“短 __stdcall SQLGetData(void *,unsigned Short,short,void *,long,long *)" (?SQLGetData@@$$J224YGFPAXGF0JPAJ@Z) 在函数“private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void) 中引用“(?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ)Test_WindowsForm.obj

错误 16 错误 LNK2019:函数“private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand”中引用了无法解析的外部符号“extern”C”短 __stdcall SQLFetch(void *)”(?SQLFetch@@$$J14YGFPAX@Z) (void)" (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

错误17错误LNK2019:函数“private”中引用了无法解析的外部符号“extern”C“short __stdcall SQLRowCount(void *,long *)”(?SQLRowCount@@$$J18YGFPAXPAJ@Z) : bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

错误 18 错误 LNK2019:无法解析的外部符号“extern “C”短 __stdcall SQLNumResultCols(void *,short *)”( ?SQLNumResultCols@@$$J18YGFPAXPAF@Z) 在函数“private: bool __clrcall”中引用Test_WindowsForm::Form1::ExecuteSQLCommand(void)" (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

错误 19 错误 LNK2019:无法解析的外部符号“extern”C“短__stdcall SQLDisconnect(void *)" (?SQLDisconnect@@$$J14YGFPAX@Z) 在函数“private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

错误 20 错误 LNK2019:无法解析的外部符号“extern”C “短 __stdcall SQLFreeHandle(短,void *)” (?SQLFreeHandle@@$$J18YGFFPAX@Z) 在函数“private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)”中引用 (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

<代码>错误 21 错误 LNK2019:无法解析的外部符号“extern”C“短__stdcall SQLExecDirectA(void *,unsigned char *,long)" (?SQLExecDirectA@@$$J212YGFPAPAEJ@Z) 在函数“private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)”中引用 (?ExecuteSQLCommand@Form1@Test_WindowsForm @@$$FA$AAM_NXZ) Test_WindowsForm.obj

错误22 错误 LNK2019: 函数“private: bool __clrcall Test_WindowsForm::Form1”中引用了无法解析的外部符号“extern “C”短 __stdcall SQLSetStmtAttrW(void *,long,void *,long)” (?SQLSetStmtAttrW@@$$J216YGFPAXJ0J@Z) ::执行SQLCommand(无效)” (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

错误 23 错误 LNK2019:无法解析的外部符号“extern”C“短 __stdcall SQLDriverConnectA(void *,struct HWND__ *,unsigned char *,短,无符号 char *,短,短 *,无符号短)” (?SQLDriverConnectA@@$$J232YGFPAXPAUHWND__@@PAEF2FPAFG@Z) 在函数“private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)”中引用 (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm。 obj

错误 24 错误 LNK2019:函数“private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand( void)" (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

错误 25 错误 LNK2019:引用了无法解析的外部符号“extern”C“短 __stdcall SQLSetEnvAttr(void *,long,void *,long)”(?SQLSetEnvAttr@@$$J216YGFPAXJ0J@Z)在函数“private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)”中(?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

错误 26 错误 LNK2019:无法解析的外部符号“extern”C“短 __stdcall SQLAllocHandle(short,void *,void * * )" (?SQLAllocHandle@@$$J212YGFFPAXPAPAX@Z) 在函数“private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

错误 27 致命错误 LNK1120: 24 无法解析的外部 D:\ testVS2008\Test_WindowsForm\Debug\Test_WindowsForm.exe

I'm trying to make my first Windows Forms Application. I'm trying to make an SQL connection, so i inserted my SQL function, which worked perfectly in a console application. I rewrited it a little bit, but right now, i am getting linker errors, and i don't know why.

Could someone help me, what i am doing wrong?

Thanks!

Erros:

Error 3 error LNK2028: unresolved token (0A000023) "extern "C" short __stdcall SQLGetData(void *,unsigned short,short,void *,long,long *)" (?SQLGetData@@$$J224YGFPAXGF0JPAJ@Z) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 4 error LNK2028: unresolved token (0A000024) "extern "C" short __stdcall SQLFetch(void *)" (?SQLFetch@@$$J14YGFPAX@Z) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 5 error LNK2028: unresolved token (0A000025) "extern "C" short __stdcall SQLRowCount(void *,long *)" (?SQLRowCount@@$$J18YGFPAXPAJ@Z) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 6 error LNK2028: unresolved token (0A000026) "extern "C" short __stdcall SQLNumResultCols(void *,short *)" (?SQLNumResultCols@@$$J18YGFPAXPAF@Z) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 7 error LNK2028: unresolved token (0A000027) "extern "C" short __stdcall SQLDisconnect(void *)" (?SQLDisconnect@@$$J14YGFPAX@Z) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 8 error LNK2028: unresolved token (0A000028) "extern "C" short __stdcall SQLFreeHandle(short,void *)" (?SQLFreeHandle@@$$J18YGFFPAX@Z) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 9 error LNK2028: unresolved token (0A000029) "extern "C" short __stdcall SQLExecDirectA(void *,unsigned char *,long)" (?SQLExecDirectA@@$$J212YGFPAXPAEJ@Z) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 10 error LNK2028: unresolved token (0A00002A) "extern "C" short __stdcall SQLSetStmtAttrW(void *,long,void *,long)" (?SQLSetStmtAttrW@@$$J216YGFPAXJ0J@Z) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 11 error LNK2028: unresolved token (0A00002B) "extern "C" short __stdcall SQLDriverConnectA(void *,struct HWND__ *,unsigned char *,short,unsigned char *,short,short *,unsigned short)" (?SQLDriverConnectA@@$$J232YGFPAXPAUHWND__@@PAEF2FPAFG@Z) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 12 error LNK2028: unresolved token (0A00002C) "extern "C" short __stdcall SQLSetConnectAttrW(void *,long,void *,long)" (?SQLSetConnectAttrW@@$$J216YGFPAXJ0J@Z) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 13 error LNK2028: unresolved token (0A00002D) "extern "C" short __stdcall SQLSetEnvAttr(void *,long,void *,long)" (?SQLSetEnvAttr@@$$J216YGFPAXJ0J@Z) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 14 error LNK2028: unresolved token (0A00002E) "extern "C" short __stdcall SQLAllocHandle(short,void *,void * *)" (?SQLAllocHandle@@$$J212YGFFPAXPAPAX@Z) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 15 error LNK2019: unresolved external symbol "extern "C" short __stdcall SQLGetData(void *,unsigned short,short,void *,long,long *)" (?SQLGetData@@$$J224YGFPAXGF0JPAJ@Z) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 16 error LNK2019: unresolved external symbol "extern "C" short __stdcall SQLFetch(void *)" (?SQLFetch@@$$J14YGFPAX@Z) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 17 error LNK2019: unresolved external symbol "extern "C" short __stdcall SQLRowCount(void *,long *)" (?SQLRowCount@@$$J18YGFPAXPAJ@Z) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 18 error LNK2019: unresolved external symbol "extern "C" short __stdcall SQLNumResultCols(void *,short *)" (?SQLNumResultCols@@$$J18YGFPAXPAF@Z) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 19 error LNK2019: unresolved external symbol "extern "C" short __stdcall SQLDisconnect(void *)" (?SQLDisconnect@@$$J14YGFPAX@Z) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 20 error LNK2019: unresolved external symbol "extern "C" short __stdcall SQLFreeHandle(short,void *)" (?SQLFreeHandle@@$$J18YGFFPAX@Z) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 21 error LNK2019: unresolved external symbol "extern "C" short __stdcall SQLExecDirectA(void *,unsigned char *,long)" (?SQLExecDirectA@@$$J212YGFPAXPAEJ@Z) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 22 error LNK2019: unresolved external symbol "extern "C" short __stdcall SQLSetStmtAttrW(void *,long,void *,long)" (?SQLSetStmtAttrW@@$$J216YGFPAXJ0J@Z) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 23 error LNK2019: unresolved external symbol "extern "C" short __stdcall SQLDriverConnectA(void *,struct HWND__ *,unsigned char *,short,unsigned char *,short,short *,unsigned short)" (?SQLDriverConnectA@@$$J232YGFPAXPAUHWND__@@PAEF2FPAFG@Z) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 24 error LNK2019: unresolved external symbol "extern "C" short __stdcall SQLSetConnectAttrW(void *,long,void *,long)" (?SQLSetConnectAttrW@@$$J216YGFPAXJ0J@Z) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 25 error LNK2019: unresolved external symbol "extern "C" short __stdcall SQLSetEnvAttr(void *,long,void *,long)" (?SQLSetEnvAttr@@$$J216YGFPAXJ0J@Z) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 26 error LNK2019: unresolved external symbol "extern "C" short __stdcall SQLAllocHandle(short,void *,void * *)" (?SQLAllocHandle@@$$J212YGFFPAXPAPAX@Z) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" (?ExecuteSQLCommand@Form1@Test_WindowsForm@@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 27 fatal error LNK1120: 24 unresolved externals D:\testVS2008\Test_WindowsForm\Debug\Test_WindowsForm.exe

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

孤独患者 2024-12-24 05:26:35

您需要将 odbc32.lib 添加到项目的链接器输入

You need to add odbc32.lib to your project's linker inputs.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文