Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing PCL_EXPORTS in pcl_visualizer.h #1995

Merged
merged 2 commits into from
Sep 18, 2017

Conversation

CSBVision
Copy link
Contributor

When using PCL in Visual C++ projects with enabled common language runtime support (/CLR option), including pcl_visualizer.h yields a link error LNK2001 since FPSCallback is used (cf. line 1986) while FPSCallback::Execute() is pure virtual and there is no other derived struct providing an implementation. Hence, supplying a default implementation fixes this link error.
Maybe see also this thread on stackoverflow where the same issue has already been discussed: https://stackoverflow.com/questions/26889614/error-lnk2001-when-including-pcl-visualizer-h

When using PCL in Visual C++ projects with enabled common language runtime support (/CLR option), including pcl_visualizer.h yields a link error LNK2001 since  FPSCallback is used (cf. line 1986) while FPSCallback::Execute() is pure virtual and there is no other derived struct providing an implementation. Hence, supplying a default implementation fixes this link error.
Maybe see also this thread on stackoverflow where the same issue has already been discussed: https://stackoverflow.com/questions/26889614/error-lnk2001-when-including-pcl-visualizer-h
@taketwo
Copy link
Member

taketwo commented Sep 15, 2017

The function FPSCallback::Execute is not pure virtual, and it is defined in the implementation file. Therefore, your proposed solution causes redefinition error (see Travis log).

As an alternative solution, can you instead try to add PCL_EXPORTS to the structure declaration, i.e.

struct PCL_EXPORTS FPSCallback : public vtkCommand

and see if it helps on Windows.

@CSBVision
Copy link
Contributor Author

Thanks for your comment!
Indeed you are right, the function is implemented in the cpp file; Before I just checked the headers (no other references found) as well as the pcl visualization dll which does not export the FPSCallback. Adding the PCL_EXPORTS to the callback struct requires to recompile the whole visualization dll, I'll check this soon and might update the PR accordingly.

@taketwo
Copy link
Member

taketwo commented Sep 15, 2017

If it turns out to work, please add PCL_EXPORTS to the other two sibling callback structures (i.e. ExitMainLoopTimerCallback, and ExitCallback). Thanks!

@CSBVision
Copy link
Contributor Author

Sure, I added them and test it soon

@CSBVision
Copy link
Contributor Author

Just finished the recompiling of PCL; the functions are exported by the dll right now and this fixes this issue. However, there seems to be a general problem in other files (for instance including <pcl/visualization/range_image_visualizer.h> yields link errors link errors as well). Maybe these are caused by some other missing PCL_EXPORTS, but I did not dig into this issue so far...

For the moment I updated pcl_visulizer.h in my PR, expecting a successful build :-)

@taketwo taketwo merged commit c669ea6 into PointCloudLibrary:master Sep 18, 2017
@taketwo
Copy link
Member

taketwo commented Sep 18, 2017

Thanks

UnaNancyOwen pushed a commit to UnaNancyOwen/pcl that referenced this pull request Nov 24, 2017
Add PCL_EXPORTS to private command classes within PCLVisualizer
@taketwo taketwo changed the title Update pcl_visualizer.h Add missing PCL_EXPEORTS in pcl_visualizer.h Sep 2, 2018
@taketwo taketwo changed the title Add missing PCL_EXPEORTS in pcl_visualizer.h Add missing PCL_EXPORTS in pcl_visualizer.h Sep 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants