在测试Vcglib一些功能函数时,发生如下错误:
KdTreeTest.obj : error LNK2019: 无法解析的外部符号 "public: unsigned __int64 __cdecl vcg::ply::PropDescriptor::memtypesize(void)const " (?memtypesize@PropDescriptor@ply@vcg@@QEBA_KXZ),该符号在函数 "public: static int __cdecl vcg::tri::io::ImporterPLY<class MyMesh>::Open(class MyMesh &,char const *,class vcg::tri::io::PlyInfo &)" (?Open@?$ImporterPLY@VMyMesh@@@io@tri@vcg@@SAHAEAVMyMesh@@PEBDAEAVPlyInfo@234@@Z) 中被引用
1>KdTreeTest.obj : error LNK2019: 无法解析的外部符号 "public: char const * __cdecl vcg::ply::PropDescriptor::stotypename(void)const " (?stotypename@PropDescriptor@ply@vcg@@QEBAPEBDXZ),该符号在函数 "public: static int __cdecl vcg::tri::io::ExporterPLY<class MyMesh>::Save(class MyMesh &,char const *,bool,class vcg::tri::io::PlyInfo &,bool (__cdecl*)(int,char const *))" (?Save@?$ExporterPLY@VMyMesh@@@io@tri@vcg@@SAHAEAVMyMesh@@PEBD_NAEAVPlyInfo@234@P6A_NH1@Z@Z) 中被引用
1>KdTreeTest.obj : error LNK2019: 无法解析的外部符号 "private: void __cdecl vcg::ply::PlyFile::compile(class vcg::ply::PlyElement *)" (?compile@PlyFile@ply@vcg@@AEAAXPEAVPlyElement@23@@Z),该符号在函数 "public: static int __cdecl vcg::tri::io::ImporterPLY<class MyMesh>::Open(class MyMesh &,char const *,class vcg::tri::io::PlyInfo &)" (?Open@?$ImporterPLY@VMyMesh@@@io@tri@vcg@@SAHAEAVMyMesh@@PEBDAEAVPlyInfo@234@@Z) 中被引用
1>KdTreeTest.obj : error LNK2019: 无法解析的外部符号 "public: __cdecl vcg::ply::PlyFile::PlyFile(void)" (??0PlyFile@ply@vcg@@QEAA@XZ),该符号在函数 "public: static int __cdecl vcg::tri::io::ImporterPLY<class MyMesh>::Open(class MyMesh &,char const *,class vcg::tri::io::PlyInfo &)" (?Open@?$ImporterPLY@VMyMesh@@@io@tri@vcg@@SAHAEAVMyMesh@@PEBDAEAVPlyInfo@234@@Z) 中被引用
1>KdTreeTest.obj : error LNK2019: 无法解析的外部符号 "public: __cdecl vcg::ply::PlyFile::~PlyFile(void)" (??1PlyFile@ply@vcg@@QEAA@XZ),该符号在函数 "public: static int __cdecl vcg::tri::io::ImporterPLY<class MyMesh>::Open(class MyMesh &,char const *,class vcg::tri::io::PlyInfo &)" (?Open@?$ImporterPLY@VMyMesh@@@io@tri@vcg@@SAHAEAVMyMesh@@PEBDAEAVPlyInfo@234@@Z) 中被引用
1>KdTreeTest.obj : error LNK2019: 无法解析的外部符号 "public: int __cdecl vcg::ply::PlyFile::Open(char const *,int)" (?Open@PlyFile@ply@vcg@@QEAAHPEBDH@Z),该符号在函数 "public: static int __cdecl vcg::tri::io::ImporterPLY<class MyMesh>::Open(class MyMesh &,char const *,class vcg::tri::io::PlyInfo &)" (?Open@?$ImporterPLY@VMyMesh@@@io@tri@vcg@@SAHAEAVMyMesh@@PEBDAEAVPlyInfo@234@@Z) 中被引用
1>KdTreeTest.obj : error LNK2019: 无法解析的外部符号 "public: int __cdecl vcg::ply::PlyFile::AddToRead(char const *,char const *,int,int,unsigned __int64,int,int,int,int,unsigned __int64)" (?AddToRead@PlyFile@ply@vcg@@QEAAHPEBD0HH_KHHHH1@Z),该符号在函数 "public: static int __cdecl vcg::tri::io::ImporterPLY<class MyMesh>::Open(class MyMesh &,char const *,class vcg::tri::io::PlyInfo &)" (?Open@?$ImporterPLY@VMyMesh@@@io@tri@vcg@@SAHAEAVMyMesh@@PEBDAEAVPlyInfo@234@@Z) 中被引用
1>KdTreeTest.obj : error LNK2019: 无法解析的外部符号 "public: char const * __cdecl vcg::ply::PlyFile::ElemName(int)" (?ElemName@PlyFile@ply@vcg@@QEAAPEBDH@Z),该符号在函数 "public: static int __cdecl vcg::tri::io::ImporterPLY<class MyMesh>::Open(class MyMesh &,char const *,class vcg::tri::io::PlyInfo &)" (?Open@?$ImporterPLY@VMyMesh@@@io@tri@vcg@@SAHAEAVMyMesh@@PEBDAEAVPlyInfo@234@@Z) 中被引用
1>KdTreeTest.obj : error LNK2019: 无法解析的外部符号 "public: int __cdecl vcg::ply::PlyFile::ElemNumber(int)const " (?ElemNumber@PlyFile@ply@vcg@@QEBAHH@Z),该符号在函数 "public: static int __cdecl vcg::tri::io::ImporterPLY<class MyMesh>::Open(class MyMesh &,char const *,class vcg::tri::io::PlyInfo &)" (?Open@?$ImporterPLY@VMyMesh@@@io@tri@vcg@@SAHAEAVMyMesh@@PEBDAEAVPlyInfo@234@@Z) 中被引用
1>KdTreeTest.obj : error LNK2019: 无法解析的外部符号 "public: int __cdecl vcg::ply::PlyFile::Read(void *)" (?Read@PlyFile@ply@vcg@@QEAAHPEAX@Z),该符号在函数 "public: static int __cdecl vcg::tri::io::ImporterPLY<class MyMesh>::Open(class MyMesh &,char const *,class vcg::tri::io::PlyInfo &)" (?Open@?$ImporterPLY@VMyMesh@@@io@tri@vcg@@SAHAEAVMyMesh@@PEBDAEAVPlyInfo@234@@Z) 中被引用
1>KdTreeTest.obj : error LNK2019: 无法解析的外部符号 "void __cdecl vcg::ply::interpret_texture_name(char const *,char const *,char *)" (?interpret_texture_name@ply@vcg@@YAXPEBD0PEAD@Z),该符号在函数 "public: static int __cdecl vcg::tri::io::ImporterPLY<class MyMesh>::Open(class MyMesh &,char const *,class vcg::tri::io::PlyInfo &)" (?Open@?$ImporterPLY@VMyMesh@@@io@tri@vcg@@SAHAEAVMyMesh@@PEBDAEAVPlyInfo@234@@Z) 中被引用
这些错误通常都是使用一些库没有包含对应lib文件所出现的,但是vcglib都是头文件没有lib文件。
经过搜索,找到一个解决方案:https://www.gamedev.net/forums/topic/622253-problems-with-vcglib。
解决方法
- 直接包含
- 可以将这个cpp文件,加入当前目录即可,让编译器找到相关的符号。