MarkusEich / cpf_segmentation

Constrained Plane Fitting library for unsupervised segmentation of 3D point clouds
Apache License 2.0
81 stars 43 forks source link

LNK Error 2001 when trying to build on MS VS 2015 #7

Open NatholBMX opened 7 years ago

NatholBMX commented 7 years ago

Hey,

I would like to try your code but have problems building it. I'm using Windows 10 x64 with MS VS 2015, release configuration x64. Following errors occur when I try to build your project:

segmentation.lib(segmentation.obj): error LNK2001: Nicht aufgelöstes externes Symbol ""public: virtual bool __cdecl pcl::SampleConsensusModelPlane<struct pcl::PointNormal>::computeModelCoefficients(class std::vector<int,class std::allocator<int> > const &,class Eigen::Matrix<float,-1,1,0,-1,1> &)" (?computeModelCoefficients@?$SampleConsensusModelPlane@UPointNormal@pcl@@@pcl@@UEAA_NAEBV?$vector@HV?$allocator@H@std@@@std@@AEAV?$Matrix@M$0?0$00$0A@$0?0$00@Eigen@@@Z)". segmentation.lib(segmentation.obj) : error LNK2001: Nicht aufgelöstes externes Symbol ""public: virtual void __cdecl pcl::SampleConsensusModelPlane<struct pcl::PointNormal>::getDistancesToModel(class Eigen::Matrix<float,-1,1,0,-1,1> const &,class std::vector<double,class std::allocator<double> > &)" (?getDistancesToModel@?$SampleConsensusModelPlane@UPointNormal@pcl@@@pcl@@UEAAXAEBV?$Matrix@M$0?0$00$0A@$0?0$00@Eigen@@AEAV?$vector@NV?$allocator@N@std@@@std@@@Z)". segmentation.lib(segmentation.obj) : error LNK2001: Nicht aufgelöstes externes Symbol ""public: virtual void __cdecl pcl::SampleConsensusModelPlane<struct pcl::PointNormal>::selectWithinDistance(class Eigen::Matrix<float,-1,1,0,-1,1> const &,double,class std::vector<int,class std::allocator<int> > &)" (?selectWithinDistance@?$SampleConsensusModelPlane@UPointNormal@pcl@@@pcl@@UEAAXAEBV?$Matrix@M$0?0$00$0A@$0?0$00@Eigen@@NAEAV?$vector@HV?$allocator@H@std@@@std@@@Z)". segmentation.lib(segmentation.obj) : error LNK2001: Nicht aufgelöstes externes Symbol ""public: virtual int __cdecl pcl::SampleConsensusModelPlane<struct pcl::PointNormal>::countWithinDistance(class Eigen::Matrix<float,-1,1,0,-1,1> const &,double)" (?countWithinDistance@?$SampleConsensusModelPlane@UPointNormal@pcl@@@pcl@@UEAAHAEBV?$Matrix@M$0?0$00$0A@$0?0$00@Eigen@@N@Z)". segmentation.lib(segmentation.obj) : error LNK2001: Nicht aufgelöstes externes Symbol ""public: virtual void __cdecl pcl::SampleConsensusModelPlane<struct pcl::PointNormal>::optimizeModelCoefficients(class std::vector<int,class std::allocator<int> > const &,class Eigen::Matrix<float,-1,1,0,-1,1> const &,class Eigen::Matrix<float,-1,1,0,-1,1> &)" (?optimizeModelCoefficients@?$SampleConsensusModelPlane@UPointNormal@pcl@@@pcl@@UEAAXAEBV?$vector@HV?$allocator@H@std@@@std@@AEBV?$Matrix@M$0?0$00$0A@$0?0$00@Eigen@@AEAV56@@Z)". segmentation.lib(segmentation.obj) : error LNK2001: Nicht aufgelöstes externes Symbol ""public: virtual void __cdecl pcl::SampleConsensusModelPlane<struct pcl::PointNormal>::projectPoints(class std::vector<int,class std::allocator<int> > const &,class Eigen::Matrix<float,-1,1,0,-1,1> const &,class pcl::PointCloud<struct pcl::PointNormal> &,bool)" (?projectPoints@?$SampleConsensusModelPlane@UPointNormal@pcl@@@pcl@@UEAAXAEBV?$vector@HV?$allocator@H@std@@@std@@AEBV?$Matrix@M$0?0$00$0A@$0?0$00@Eigen@@AEAV?$PointCloud@UPointNormal@pcl@@@2@_N@Z)". segmentation.lib(segmentation.obj) : error LNK2001: Nicht aufgelöstes externes Symbol ""public: virtual bool __cdecl pcl::SampleConsensusModelPlane<struct pcl::PointNormal>::doSamplesVerifyModel(class std::set<int,struct std::less<int>,class std::allocator<int> > const &,class Eigen::Matrix<float,-1,1,0,-1,1> const &,double)" (?doSamplesVerifyModel@?$SampleConsensusModelPlane@UPointNormal@pcl@@@pcl@@UEAA_NAEBV?$set@HU?$less@H@std@@V?$allocator@H@2@@std@@AEBV?$Matrix@M$0?0$00$0A@$0?0$00@Eigen@@N@Z)". segmentation.lib(segmentation.obj) : error LNK2001: Nicht aufgelöstes externes Symbol ""private: virtual bool __cdecl pcl::SampleConsensusModelPlane<struct pcl::PointNormal>::isSampleGood(class std::vector<int,class std::allocator<int> > const &)const " (?isSampleGood@?$SampleConsensusModelPlane@UPointNormal@pcl@@@pcl@@EEBA_NAEBV?$vector@HV?$allocator@H@std@@@std@@@Z)".

MarkusEich commented 7 years ago

Hi,

The library builds on pcl library. The code has been developed and tested for ubuntu Linux and gnu Tool chain.

Cheers

Markus

Am 12.06.2017 18:25 schrieb "NatholBMX" notifications@github.com:

Hey,

I would like to try your code but have problems building it. I'm using Windows 10 x64 with MS VS 2015, release configuration x64. Following errors occur when I try to build your project:

segmentation.lib(segmentation.obj) : error LNK2001: Nicht aufgelöstes externes Symbol ""public: virtual bool cdecl pcl:: SampleConsensusModelPlane::computeModelCoefficients(class std::vector<int,class std::allocator > const &,class Eigen::Matrix<float,-1,1,0,-1,1> &)" (?computeModelCoefficients@?$ SampleConsensusModelPlane@UPointNormal@pcl@@@pcl https://github.com/pcl @@UEAA_NAEBV?$vector@HV?$allocator@H@std@@@std https://github.com/std @@aeav?$Matrix@M$0?0$00$0A@$0?0$00@Eigen@@@z https://github.com/z)". 1>segmentation.lib(segmentation.obj) : error LNK2001: Nicht aufgelöstes externes Symbol ""public: virtual void cdecl pcl:: SampleConsensusModelPlane::getDistancesToModel(class Eigen::Matrix<float,-1,1,0,-1,1> const &,class std::vector<double,class std::allocator > &)" (?getDistancesToModel@?$SampleConsensusModelPlane@ UPointNormal@pcl@@@pcl https://github.com/pcl@@ueaaxaebv?$Matrix@M $0?0$00$0A@$0?0$00@Eigen@@aeav?$vector@NV?$allocator@N@std@@@std https://github.com/std@@@z https://github.com/z)". 1>segmentation.lib(segmentation.obj) : error LNK2001: Nicht aufgelöstes externes Symbol ""public: virtual void cdecl pcl:: SampleConsensusModelPlane::selectWithinDistance(class Eigen::Matrix<float,-1,1,0,-1,1> const &,double,class std::vector<int,class std::allocator > &)" (?selectWithinDistance@?$ SampleConsensusModelPlane@UPointNormal@pcl@@@pcl https://github.com/pcl @@ueaaxaebv?$Matrix@M$0?0$00$0A@$0?0$00@Eigen@@naeav https://github.com/naeav?$vector@HV?$allocator@H@std@@@std https://github.com/std@@@z https://github.com/z)". 1>segmentation.lib(segmentation.obj) : error LNK2001: Nicht aufgelöstes externes Symbol ""public: virtual int cdecl pcl:: SampleConsensusModelPlane::countWithinDistance(class Eigen::Matrix<float,-1,1,0,-1,1> const &,double)" (?countWithinDistance@?$ SampleConsensusModelPlane@UPointNormal@pcl@@@pcl https://github.com/pcl @@ueaahaebv?$Matrix@M$0?0$00$0A@$0?0$00@Eigen@@n https://github.com/n @Z)". 1>segmentation.lib(segmentation.obj) : error LNK2001: Nicht aufgelöstes externes Symbol ""public: virtual void cdecl pcl:: SampleConsensusModelPlane::optimizeModelCoefficients(class std::vector<int,class std::allocator > const &,class Eigen::Matrix<float,-1,1,0,-1,1> const &,class Eigen::Matrix<float,-1,1,0,-1,1> &)" (?optimizeModelCoefficients@?$ SampleConsensusModelPlane@UPointNormal@pcl@@@pcl https://github.com/pcl @@ueaaxaebv?$vector@HV?$allocator@H@std@@@std https://github.com/std @@aebv?$Matrix@M$0?0$00$0A@$0?0$00@Eigen@@aeav56@@z https://github.com/z )". 1>segmentation.lib(segmentation.obj) : error LNK2001: Nicht aufgelöstes externes Symbol ""public: virtual void __cdecl pcl:: SampleConsensusModelPlane::projectPoints(class std::vector<int,class std::allocator > const &,class Eigen::Matrix<float,-1,1,0,-1,1> const &,class pcl::PointCloud &,bool)" (?projectPoints@?$ SampleConsensusModelPlane@UPointNormal@pcl@@@pcl https://github.com/pcl @@ueaaxaebv?$vector@HV?$allocator@H@std@@@std https://github.com/std @@aebv?$Matrix@M$0?0$00$0A@$0?0$00@Eigen@@aeav?$PointCloud@ UPointNormal@pcl@@@2 https://github.com/2@_N@Z)". 1>segmentation.lib(segmentation.obj) : error LNK2001: Nicht aufgelöstes externes Symbol ""public: virtual bool cdecl pcl:: SampleConsensusModelPlane::doSamplesVerifyModel(class std::set<int,struct std::less,class std::allocator > const &,class Eigen::Matrix<float,-1,1,0,-1,1> const &,double)" (?doSamplesVerifyModel@ ?$SampleConsensusModelPlane@UPointNormal@pcl@@@pcl https://github.com/pcl@@UEAA_NAEBV?$set@HU?$less@H@std@@v https://github.com/v?$allocator@H@2@@std https://github.com/std @@aebv?$Matrix@M$0?0$00$0A@$0?0$00@Eigen@@n https://github.com/n@Z)". 1>segmentation.lib(segmentation.obj) : error LNK2001: Nicht aufgelöstes externes Symbol ""private: virtual bool __cdecl pcl:: SampleConsensusModelPlane::isSampleGood(class std::vector<int,class std::allocator > const &)const " (?isSampleGood@?$ SampleConsensusModelPlane@UPointNormal@pcl@@@pcl https://github.com/pcl @@EEBA_NAEBV?$vector@HV?$allocator@H@std@@@std https://github.com/std@@ @z https://github.com/z)".

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/MarkusEich/cpf_segmentation/issues/7, or mute the thread https://github.com/notifications/unsubscribe-auth/AEUvZN9G5iTJxUnHYUzfppLU-dkCtYELks5sDWZsgaJpZM4N3Wye .

HollisJoe commented 7 years ago

Hi, Did you solve the problem? Thank you!

JR9124 commented 5 years ago

Hi, @NatholBMX I have also met the problem as you stated. I try to solve the problem as the following way: I think the main reason caused these link errors is the code pcl::SampleConsensusModelPlane<pcl::PointNormal>::Ptr model_p(new pcl::SampleConsensusModelPlane<pcl::PointNormal>(sv_centroid_normal_cloud)); in segmentation.cpp , thus, I change the code to pcl::PointCloud<pcl::PointXYZ>::Ptr tmp_cloud(new pcl::PointCloud<pcl::PointXYZ>); pcl::copyPointCloud(*sv_centroid_normal_cloud, *tmp_cloud); pcl::SampleConsensusModelPlane<pcl::PointXYZ>::Ptr model_p(new pcl::SampleConsensusModelPlane<pcl::PointXYZ>(tmp_cloud));. I think this change would not change the result as model_p is only for plane hypothesis generation. After the change, you can re-compile then you get the error 'can't find Release\segmentation.lib', while you can find segmentation.dll. To solve this, add a new .def file to segmentation project( right click the project in vs, select 'add->new item->code->module define file', the name of the added file is not important and the file could be deleted afterward if you want ), then re-compile. Note that, the exported dll and lib has no entry, you must change class Segmentation to class __declspec(dllexport) Segmentation in segmentation.hpp. Then re-compile, and you can get the right result.

emmalzw commented 2 years ago

Hi, @NatholBMX I have also met the problem as you stated. I try to solve the problem as the following way: I think the main reason caused these link errors is the code pcl::SampleConsensusModelPlane<pcl::PointNormal>::Ptr model_p(new pcl::SampleConsensusModelPlane<pcl::PointNormal>(sv_centroid_normal_cloud)); in segmentation.cpp , thus, I change the code to pcl::PointCloud<pcl::PointXYZ>::Ptr tmp_cloud(new pcl::PointCloud<pcl::PointXYZ>); pcl::copyPointCloud(*sv_centroid_normal_cloud, *tmp_cloud); pcl::SampleConsensusModelPlane<pcl::PointXYZ>::Ptr model_p(new pcl::SampleConsensusModelPlane<pcl::PointXYZ>(tmp_cloud));. I think this change would not change the result as model_p is only for plane hypothesis generation. After the change, you can re-compile then you get the error 'can't find Release\segmentation.lib', while you can find segmentation.dll. To solve this, add a new .def file to segmentation project( right click the project in vs, select 'add->new item->code->module define file', the name of the added file is not important and the file could be deleted afterward if you want ), then re-compile. Note that, the exported dll and lib has no entry, you must change class Segmentation to class __declspec(dllexport) Segmentation in segmentation.hpp. Then re-compile, and you can get the right result.

THX! Your answer is very useful and I successlly compiled already. But why after changing the class pcl::SampleConsensusModelPlane<pcl::PointNormal>to the class pcl::SampleConsensusModelPlane<pcl::PointNormal> the code work? Can u tell me the reason? :)