xmake-io / xmake-repo

📦 An official xmake package repository
https://xrepo.xmake.io
Apache License 2.0
627 stars 377 forks source link

vcglib import error #4608

Closed zhangzhousuper closed 2 weeks ago

zhangzhousuper commented 2 weeks ago

Xmake Version

111

Operating System Version and Architecture

11

Describe Bug

after I import vcglib in my project, there still exists link error

include <vcg/complex/complex.h>

include <vcg/complex/algorithms/smooth.h>

include <wrap/io_trimesh/import.h>

include <wrap/io_trimesh/export_ply.h>

include <wrap/ply/plylib.h>

class MyVertex; class MyFace; struct MyUsedTypes : public vcg::UsedTypes<vcg::Use::AsVertexType, vcg::Use::AsFaceType> {};

class MyVertex : public vcg::Vertex<MyUsedTypes, vcg::vertex::Coord3f, vcg::vertex::Normal3f, vcg::vertex::BitFlags> {}; class MyFace : public vcg::Face<MyUsedTypes, vcg::face::VertexRef, vcg::face::Normal3f, vcg::face::BitFlags> {}; class MyMesh : public vcg::tri::TriMesh<std::vector, std::vector> {};

int main() { MyMesh m;

vcg::tri::io::ImporterPLY<MyMesh>::Open(m,"namefile_to_open.ply");

// .... vcg::tri::io::ExporterPLY::Save(m,"namefile_to_save.ply");

return 0;

}

main.cpp.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::Open(class MyMesh &,char const ,class vcg::tri::io::PlyInfo &)" (?Open@?$ImporterPLY@VMyMesh@@@io@tri@vcg@@SAHAEAVMyMesh@@PEBDAEAVPlyInfo@234@@Z) 中引用了该符号 main.cpp.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::Save(class MyMesh const &,char const *,bool,class vcg::tri::io::PlyInfo const &,bool (cdecl)(int,char const ))" (?Save@?$ExporterPLY@VMyMesh@@@io@tri@vcg@@SAHAEBVMyMesh@@PEBD_NAEBVPlyInfo@234@P6A_NH1@Z@Z) 中引用了该符号

seems like the bug can be solved like this https://github.com/cnr-isti-vclab/vcglib/issues/59

Expected Behavior

run

Project Configuration

run

Additional Information and Error Logs

run

star-hengxing commented 2 weeks ago

The library only support header only mode, so user need to add the cpp files to the project