原文地址:http://blog.csdn.net/bbppbb/article/details/38414943
学习代码:http://blog.csdn.net/chaojiwudixiaofeixia/article/details/50460887
错误说明
跟原文的这些错误类似(如下),本人的是OpenMesh::PolyMesh_ArrayKernelT无法解析
- 1>main.obj : error LNK2001: 无法解析的外部符号 "public: bool __thiscall OpenVolumeMesh::IO::FileManager::readFile<class OpenVolumeMesh::GeometryKernel<class OpenVolumeMesh::Geometry::VectorT<float,3>,class OpenVolumeMesh::TopologyKernel> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class OpenVolumeMesh::GeometryKernel<class OpenVolumeMesh::Geometry::VectorT<float,3>,class OpenVolumeMesh::TopologyKernel> &,bool,bool)const " (??$readFile@V?$GeometryKernel@V?$VectorT@M$02@Geometry@OpenVolumeMesh@@VTopologyKernel@3@@OpenVolumeMesh@@@FileManager@IO@OpenVolumeMesh@@QBE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAV?$GeometryKernel@V?$VectorT@M$02@Geometry@OpenVolumeMesh@@VTopologyKernel@3@@2@_N2@Z)
问题解决过程
很长的错误,但是很明显的就是说readFile这个函数不匹配或者未定义,通常情况下这种错误的原因有以下几种:
1. Debug和Release版本的库混用
2. X86和x64的库混用
3. 编译库的编译器版本不同,比如说VS2010编译出的库一般情况是不能用在VS2013的
4. 这个函数仅仅在头文件中声明,但是编译时候没有链接到lib中(这个错误原因属于此)
我自己问题原因是3.因为project是32位控制台程序,所以经常默认是x86编译,本人电脑win10、VS2015、OpenMesh-6.3-VS2015-64-Bit,所以修改成64编译,就没有问题了。