由于GDAL中的ODBC链接错误,无法使用Visual Studio 2013构建OSG Earth

Unable to build OSG Earth with Visual Studio 2013 due to ODBC link error in GDAL

本文关键字:Studio Visual 2013 构建 Earth OSG ODBC 中的 GDAL 链接 错误      更新时间:2023-10-16

我正在尝试使用CMAKE和Visual studio 2013 构建OSGEarth

我首先从这个页面下载了Open Scene Graph 3.2和预构建依赖项(小程序包)。我生成了visual studio 2013项目,并在没有太多问题的情况下构建/安装了开放场景图

在那之后,我下载了osgearth 2.5的源代码,并生成了Visual Studio 2013项目,使用了与Open Scene Graph相同的依赖项(我不想在第一次构建时使用可选的依赖项)。当我尝试构建osgearth项目时,我在链接步骤中遇到了以下错误:

2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLAllocConnect@8 referenced in function "public: int __thiscall CPLODBCSession::EstablishSession(char const *,char const *,char const *)" (?EstablishSession@CPLODBCSession@@QAEHPBD00@Z)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLAllocEnv@4 referenced in function "public: int __thiscall CPLODBCSession::EstablishSession(char const *,char const *,char const *)" (?EstablishSession@CPLODBCSession@@QAEHPBD00@Z)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLAllocStmt@8 referenced in function "public: __thiscall CPLODBCStatement::CPLODBCStatement(class CPLODBCSession *)" (??0CPLODBCStatement@@QAE@PAVCPLODBCSession@@@Z)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLColAttribute@28 referenced in function "public: int __thiscall CPLODBCStatement::CollectResultsInfo(void)" (?CollectResultsInfo@CPLODBCStatement@@QAEHXZ)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLColumns@36 referenced in function "public: int __thiscall CPLODBCStatement::GetColumns(char const *,char const *,char const *)" (?GetColumns@CPLODBCStatement@@QAEHPBD00@Z)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLConnect@28 referenced in function "public: int __thiscall CPLODBCSession::EstablishSession(char const *,char const *,char const *)" (?EstablishSession@CPLODBCSession@@QAEHPBD00@Z)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLDescribeCol@36 referenced in function "public: int __thiscall CPLODBCStatement::CollectResultsInfo(void)" (?CollectResultsInfo@CPLODBCStatement@@QAEHXZ)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLDisconnect@4 referenced in function "public: int __thiscall CPLODBCSession::CloseSession(void)" (?CloseSession@CPLODBCSession@@QAEHXZ)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLEndTran@12 referenced in function "public: int __thiscall CPLODBCSession::CommitTransaction(void)" (?CommitTransaction@CPLODBCSession@@QAEHXZ)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLError@32 referenced in function "public: int __thiscall CPLODBCSession::Failed(int,void *)" (?Failed@CPLODBCSession@@QAEHHPAX@Z)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLExecDirect@12 referenced in function "public: int __thiscall CPLODBCStatement::ExecuteSQL(char const *)" (?ExecuteSQL@CPLODBCStatement@@QAEHPBD@Z)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLFetch@4 referenced in function "public: int __thiscall CPLODBCStatement::Fetch(int,int)" (?Fetch@CPLODBCStatement@@QAEHHH@Z)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLFetchScroll@12 referenced in function "public: int __thiscall CPLODBCStatement::Fetch(int,int)" (?Fetch@CPLODBCStatement@@QAEHHH@Z)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLFreeConnect@4 referenced in function "public: int __thiscall CPLODBCSession::CloseSession(void)" (?CloseSession@CPLODBCSession@@QAEHXZ)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLFreeEnv@4 referenced in function "public: int __thiscall CPLODBCSession::CloseSession(void)" (?CloseSession@CPLODBCSession@@QAEHXZ)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLFreeStmt@8 referenced in function "public: __thiscall CPLODBCStatement::~CPLODBCStatement(void)" (??1CPLODBCStatement@@QAE@XZ)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLGetConnectAttr@20 referenced in function "public: int __thiscall CPLODBCSession::ClearTransaction(void)" (?ClearTransaction@CPLODBCSession@@QAEHXZ)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLGetData@24 referenced in function "public: int __thiscall CPLODBCStatement::Fetch(int,int)" (?Fetch@CPLODBCStatement@@QAEHHH@Z)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLNumResultCols@8 referenced in function "public: int __thiscall CPLODBCStatement::CollectResultsInfo(void)" (?CollectResultsInfo@CPLODBCStatement@@QAEHXZ)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLSetConnectAttr@16 referenced in function "public: int __thiscall CPLODBCSession::ClearTransaction(void)" (?ClearTransaction@CPLODBCSession@@QAEHXZ)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLSetConnectOption@12 referenced in function "public: int __thiscall CPLODBCSession::EstablishSession(char const *,char const *,char const *)" (?EstablishSession@CPLODBCSession@@QAEHPBD00@Z)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLTables@36 referenced in function "public: int __thiscall CPLODBCStatement::GetTables(char const *,char const *)" (?GetTables@CPLODBCStatement@@QAEHPBD0@Z)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLDriverConnect@32 referenced in function "public: int __thiscall CPLODBCSession::EstablishSession(char const *,char const *,char const *)" (?EstablishSession@CPLODBCSession@@QAEHPBD00@Z)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLPrimaryKeys@28 referenced in function "public: int __thiscall CPLODBCStatement::GetPrimaryKeys(char const *,char const *,char const *)" (?GetPrimaryKeys@CPLODBCStatement@@QAEHPBD00@Z)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLRemoveDriver@12 referenced in function "public: int __thiscall CPLODBCDriverInstaller::RemoveDriver(char const *,int)" (?RemoveDriver@CPLODBCDriverInstaller@@QAEHPBDH@Z)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLInstallerError@20 referenced in function "public: int __thiscall CPLODBCDriverInstaller::InstallDriver(char const *,char const *,unsigned short)" (?InstallDriver@CPLODBCDriverInstaller@@QAEHPBD0G@Z)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLInstallDriverEx@28 referenced in function "public: int __thiscall CPLODBCDriverInstaller::InstallDriver(char const *,char const *,unsigned short)" (?InstallDriver@CPLODBCDriverInstaller@@QAEHPBD0G@Z)

我唯一能找到的是,所有缺失的方法似乎都是不推荐使用的ODBC方法,比如这个

有关其他信息,该项目在其继承的值中获得了对odbc32.lib的引用。

好吧,愚蠢的问题。。。odbc的依赖项在继承的值中。。。但是没有选中向构建过程指示使用这些依赖关系的复选框。一旦完成,一切都很好。。。我想我要么喝杯咖啡,要么在头上狠狠地打一下。。。