Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

MFC using "SQLGetInstalledDrivers" occurs error LNK2019: unresolved external symbol _SQLGetInstalledDriversW@12

$
0
0

Dear all,

goodday~

I am using MFC of Visual Studio 2010 C++ to develop a application which can read field value in excel file,

in my code ,using the "SQLGetInstalledDrivers" functions to check whether ODBC excel driver is installed or not ;

the following part of code is the place that I add "SQLGetInstalledDrivers" in my project:

#include <afxdb.h>
#include <odbcinst.h>

#pragma comment(lib,"odbccp32.lib")

...

CString CReadExcel::GetExcelDriver()
{
 
    char szBuf[2001];
    WORD cbBufMax = 2000;
    WORD cbBufOut;
    char * pszBuf = szBuf;
    CString strDriver;

    // Get the names of the installed drivers
    if (!SQLGetInstalledDrivers((LPWSTR)szBuf , cbBufMax,&cbBufOut))
      return L"";

    ...

}

BTW,my Operating system of compiler machine is win7 64bits version ,as I know,"SQLGetInstalledDrivers" function will link/refer to odbccp32.lib ,so ,I also add additional Dependency ,like :

add library dependancies

when the building of my project ,it show the following information: ,Could you help me to solve this building project issue ?

1>ReadExcel.obj : error LNK2019: 無法解析的外部符號 _SQLGetInstalledDriversW@12在函式 "private: class ATL::CStringT<wchar_t,class StrTraitMFC<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > __thiscall CReadExcel::GetExcelDriver(void)" (?GetExcelDriver@CReadExcel@@AAE?AV?$CStringT@_WV?$StrTraitMFC@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@XZ)中被參考
1>C:\Users\ho005801\documents\visual studio 2010\Projects\ANCTrimmingBox1\Debug\ANCTrimmingBox1.exe : fatal error LNK1120: 1 個無法解析的外部符號
1>
1>建置失敗。
1>
1>經過時間 00:00:04.39
========== 建置: 0 成功、1 失敗、0 最新、0 略過 ==========


Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>