【发布时间】:2019-10-06 21:32:44
【问题描述】:
我正在开发一个 C++ 程序,该程序使用来自 Nvidia (https://developer.nvidia.com/usd) 的 Python 3 预构建库创建一个 .usda 文件。有很多外部库,我无法确定哪个导致了一堆编译器问题。有一些头文件(具体来说是 stage.h、mesh.h)会阻止我的程序编译。我从包中使用的其他头文件不会导致这些错误。
我从研究中得知,我可能缺少包含/lib 目录,或者某些内容是在不同版本上编译的,但我如何才能找到哪些文件丢失或编译不正确?
我使用的是 Windows 10、Visual Studio 2017、Python 3.6 和 Boost 1.68。 Nvidia 库位于 C:\USDP3
包括:C:\USDP3\include C:\Program Files\boost_1_68_0
库:C:\USDP3\lib C:\Program Files\boost_1_68_0 C:\USDP3\libs
示例代码:
#include "pch.h"
#define NOMINMAX
#define TBB_USE_ASSERT 0
#define TBB_USE_THREADING_TOOLS 0
#include "pxr/pxr.h"
#include "pxr/usd/usd/stage.h"
#include <iostream>
PXR_NAMESPACE_USING_DIRECTIVE
int main(int argc, char* argv[])
{
//Create Stage
UsdStage::CreateNew("Test.usda");
std::cout << "Hello World!\n";
}
导致这些错误:
1>test1.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: static char * * pxrInternal_v0_19__pxrReserved__::Sdf_Pool<struct pxrInternal_v0_19__pxrReserved__::Sdf_PathPropTag,24,8,16384>::_regionStarts" (__imp_?_regionStarts@?$Sdf_Pool@USdf_PathPropTag@pxrInternal_v0_19__pxrReserved__@@$0BI@$07$0EAAA@@pxrInternal_v0_19__pxrReserved__@@0PAPEADA)
1>test1.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: __cdecl pxrInternal_v0_19__pxrReserved__::Sdf_PrimPathNode::~Sdf_PrimPathNode(void)" (__imp_??1Sdf_PrimPathNode@pxrInternal_v0_19__pxrReserved__@@AEAA@XZ)
1>test1.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: __cdecl pxrInternal_v0_19__pxrReserved__::Sdf_MapperArgPathNode::~Sdf_MapperArgPathNode(void)" (__imp_??1Sdf_MapperArgPathNode@pxrInternal_v0_19__pxrReserved__@@AEAA@XZ)
1>test1.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: __cdecl pxrInternal_v0_19__pxrReserved__::Sdf_ExpressionPathNode::~Sdf_ExpressionPathNode(void)" (__imp_??1Sdf_ExpressionPathNode@pxrInternal_v0_19__pxrReserved__@@AEAA@XZ)
1>test1.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static void __cdecl pxrInternal_v0_19__pxrReserved__::Sdf_PrimPartPathNode::operator delete(void *)" (__imp_??3Sdf_PrimPartPathNode@pxrInternal_v0_19__pxrReserved__@@SAXPEAX@Z)
1>test1.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: __cdecl pxrInternal_v0_19__pxrReserved__::Sdf_PrimPropertyPathNode::~Sdf_PrimPropertyPathNode(void)" (__imp_??1Sdf_PrimPropertyPathNode@pxrInternal_v0_19__pxrReserved__@@AEAA@XZ)
1>test1.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: __cdecl pxrInternal_v0_19__pxrReserved__::Sdf_TargetPathNode::~Sdf_TargetPathNode(void)" (__imp_??1Sdf_TargetPathNode@pxrInternal_v0_19__pxrReserved__@@AEAA@XZ)
1>test1.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static void __cdecl pxrInternal_v0_19__pxrReserved__::Sdf_PropPartPathNode::operator delete(void *)" (__imp_??3Sdf_PropPartPathNode@pxrInternal_v0_19__pxrReserved__@@SAXPEAX@Z)
1>test1.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static bool __cdecl pxrInternal_v0_19__pxrReserved__::Tf_RefPtr_UniqueChangedCounter::_RemoveRef(class pxrInternal_v0_19__pxrReserved__::TfRefBase const *)" (__imp_?_RemoveRef@Tf_RefPtr_UniqueChangedCounter@pxrInternal_v0_19__pxrReserved__@@SA_NPEBVTfRefBase@2@@Z)
1>test1.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: __cdecl pxrInternal_v0_19__pxrReserved__::Sdf_RelationalAttributePathNode::~Sdf_RelationalAttributePathNode(void)" (__imp_??1Sdf_RelationalAttributePathNode@pxrInternal_v0_19__pxrReserved__@@AEAA@XZ)
1>test1.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: __cdecl pxrInternal_v0_19__pxrReserved__::Sdf_MapperPathNode::~Sdf_MapperPathNode(void)" (__imp_??1Sdf_MapperPathNode@pxrInternal_v0_19__pxrReserved__@@AEAA@XZ)
1>test1.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) protected: void __cdecl pxrInternal_v0_19__pxrReserved__::Sdf_PathNode::_RemovePathTokenFromTable(void)const " (__imp_?_RemovePathTokenFromTable@Sdf_PathNode@pxrInternal_v0_19__pxrReserved__@@IEBAXXZ)
1>test1.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class pxrInternal_v0_19__pxrReserved__::TfRefPtr<class pxrInternal_v0_19__pxrReserved__::UsdStage> __cdecl pxrInternal_v0_19__pxrReserved__::UsdStage::CreateNew(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,enum pxrInternal_v0_19__pxrReserved__::UsdStage::InitialLoadSet)" (__imp_?CreateNew@UsdStage@pxrInternal_v0_19__pxrReserved__@@SA?AV?$TfRefPtr@VUsdStage@pxrInternal_v0_19__pxrReserved__@@@2@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@W4InitialLoadSet@12@@Z)
1>test1.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: __cdecl pxrInternal_v0_19__pxrReserved__::Sdf_PrimVariantSelectionNode::~Sdf_PrimVariantSelectionNode(void)" (__imp_??1Sdf_PrimVariantSelectionNode@pxrInternal_v0_19__pxrReserved__@@AEAA@XZ)
1>test1.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: static char * * pxrInternal_v0_19__pxrReserved__::Sdf_Pool<struct pxrInternal_v0_19__pxrReserved__::Sdf_PathPrimTag,24,8,16384>::_regionStarts" (__imp_?_regionStarts@?$Sdf_Pool@USdf_PathPrimTag@pxrInternal_v0_19__pxrReserved__@@$0BI@$07$0EAAA@@pxrInternal_v0_19__pxrReserved__@@0PAPEADA)'
【问题讨论】:
-
您缺少指向 dll 导入库的链接。
-
这是有道理的,但我无法弄清楚 哪个 dll 丢失了。我可以在包中找到的每个库都在我包含的路径中。此处的错误消息中是否有任何内容实际上可以帮助我找到丢失的文件?
-
这个项目有多少个 .dll 文件?这不是缺少
dll,您没有链接到与该项目中现有 dll 文件一起使用的 .lib(导入库而不是静态库)文件。 -
Stage.h 中有很多头文件,所以我不确定到底有多少个 dll 文件。这是 stage.h 的样子:github.com/PixarAnimationStudios/USD/blob/master/pxr/usd/lib/…
标签: c++ python-3.x visual-studio compiler-errors nvidia