PointCloudLibrary / pcl

Point Cloud Library (PCL)
https://pointclouds.org/
Other
9.83k stars 4.6k forks source link

Link error when building example_nurbs_fitting_surface.cpp, related to pcl_surface #1313

Closed simbaforrest closed 9 years ago

simbaforrest commented 9 years ago

Hi All,

When I'm building the example_nurbs_fitting_surface.cpp, I encountered the following linking error:

2>------ Build started: Project: pcl_example_nurbs_fitting_surface, Configuration: Release x64 ------
2>Build started 8/29/2015 10:58:09 PM.
2>InitializeBuildStatus:
2>  Touching "pcl_example_nurbs_fitting_surface.dir\Release\pcl_example_nurbs_fitting_surface.unsuccessfulbuild".
2>CustomBuild:
2>  All outputs are up-to-date.
2>ClCompile:
2>  example_nurbs_fitting_surface.cpp
2>example_nurbs_fitting_surface.obj : error LNK2001: unresolved external symbol "public: bool __cdecl ONX_Model::Write(char const *,int,char const *,class ON_TextLog *)" (?Write@ONX_Model@@QEAA_NPEBDH0PEAVON_TextLog@@@Z)
2>example_nurbs_fitting_surface.obj : error LNK2001: unresolved external symbol "public: virtual __cdecl ONX_Model::~ONX_Model(void)" (??1ONX_Model@@UEAA@XZ)
2>example_nurbs_fitting_surface.obj : error LNK2001: unresolved external symbol "public: __cdecl ONX_Model::ONX_Model(void)" (??0ONX_Model@@QEAA@XZ)
2>example_nurbs_fitting_surface.obj : error LNK2001: unresolved external symbol "public: __cdecl ONX_Model_Object::~ONX_Model_Object(void)" (??1ONX_Model_Object@@QEAA@XZ)
2>example_nurbs_fitting_surface.obj : error LNK2001: unresolved external symbol "public: __cdecl ONX_Model_Object::ONX_Model_Object(void)" (??0ONX_Model_Object@@QEAA@XZ)
2>example_nurbs_fitting_surface.obj : error LNK2001: unresolved external symbol "public: class ON_wString const & __cdecl ON_wString::operator=(char const *)" (??4ON_wString@@QEAAAEBV0@PEBD@Z)
2>C:\lib\build\pcl-1.7.2\bin\pcl_example_nurbs_fitting_surface_release.exe : fatal error LNK1120: 6 unresolved externals
2>
2>Build FAILED.
2>
2>Time Elapsed 00:00:21.21

After digging into the source of pcl_surface, I found that many important classes was not exported to the DLL using PCL_EXPORT. If I add

#include <pcl/pcl_exports.h>

in file _surface/include/pcl/surface/3rdparty/opennurbs/opennurbsextensions.h, add then add

PCL_EXPORTS

for each class in that file, the example project can be linked without problem. However I'm not sure if this is a good fix or not. I'll test the example later...

Best, Chen

simbaforrest commented 9 years ago

Sorry I forgot to mention that to get the example compiled, I have to do similar modification for the class _ONwString in surface/include/pcl/surface/3rdparty/opennurbs/opennurbs_string.h

taketwo commented 9 years ago

I think this is a legit fix.

I must admit though that this module is sort of abandoned. Also if you are interested in this, perhaps you find something interesting in #1162 (which was not accepted, but nevertheless).

simbaforrest commented 9 years ago

I've created a pull for this and the last issue: https://github.com/PointCloudLibrary/pcl/pull/1315

When you say it (I assume you mean the nurbs related functions and classes) is sort of abandoned, do you mean it will be removed in the future or simply no one is maintaining it?

taketwo commented 9 years ago

The latter. I don't think there is an intention to remove it. After all, it was never released anyway, it only existed in "trunk" version of PCL.

taketwo commented 9 years ago

Fixed via #1315