简体   繁体   中英

Linker errors in a Windows Forms Application

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM