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

Windows pcl_filters project build errors: error C2487 'pcl::Filter<PointT>::applyFilter : member of dll interface class may not be declared with dll interface' #426

Closed
alex-shearer-swe opened this issue Jan 2, 2014 · 8 comments · Fixed by #449

Comments

@alex-shearer-swe
Copy link

On Windows x64 in both debug and release mode, building project pcl_filters results in the following errors:

pcl_filter error list

.. etc.

pcl_features project also does not build because it depends on pcl_filters:

"error LNK104: cannot open file '..\lib\pcl_filters_release.lib'" (same for debug)

Right now the kinfu app is not working on Windows because of this problem.

@alex-shearer-swe
Copy link
Author

On latest commit 0010c34

@rbregier
Copy link
Contributor

rbregier commented Jan 6, 2014

Hi,

In the topic :
http://www.pcl-users.org/Build-error-with-latest-source-tp4031369p4031429.html
A patch is proposed and it seems to work fine for Windows users.
(comment the line "using Filter::applyFilter;" in filters\include\pcl\filters\filter_indices.h)

@magro11
Copy link

magro11 commented Jan 16, 2014

I had the same compiler error with Visual Studio 2010 on Windows XP and 7 with 32 and 64bit and the above mentioned patch fixed the problem. It would be very nice to fix this is the head revision as well.

@taketwo
Copy link
Member

taketwo commented Jan 16, 2014

@magro11 Could you please check if adding the following lines (starting at line 64) to 'filters/shadowpoints.h' fixes the issue:

using FilterIndices<PointT>::applyFilter;
using Filter<PointT>::applyFilter;

(Please don't forget to revert the patch before. Also this is supposed to fix the problem only with 'shadowpoints.h', but it this succeeds then we'll add these lines to all other affected files.)

@magro11
Copy link

magro11 commented Jan 16, 2014

@taketwo I reverted the patch before and added the two lines in shadowpoints.h. There are still a lot of compiler errors of the same type than in the title of that issue. They only are about pcl::Filter::applyFilter, not FilterIndices::applyFilter.

Unforntunately they are also in the file shadowpoints.h although I put the two lines in the corresponding header file.

Only removing

using Filter<PointT>::applyFilter 

in filter_indices.h let the solution compile.

@taketwo
Copy link
Member

taketwo commented Jan 16, 2014

@magro11 Sorry for abusing your compiler (I do not have Windows/VS), but could you try another fix?

Replace the using line ('filter_indices.h:174') that causes the trouble with the following:

virtual void
applyFilter (PointCloud &output) = 0;

If this will not introduce new problems then I will explain what was going on and why I originally added the using line.

@magro11
Copy link

magro11 commented Jan 16, 2014

@taketwo OK, now filter_indices.h line 172ff looks like this:

using Filter<PointT>::initCompute;
using Filter<PointT>::deinitCompute;

/** \brief False = normal filter behavior (default), true = inverted behavior. */
bool negative_;

/** \brief False = remove points (default), true = redefine points, keep structure. */
bool keep_organized_;

/** \brief The user given value that the filtered point dimensions should be set to (default = NaN). */
float user_filter_value_;

/** \brief Abstract filter method for point cloud indices. */
virtual void
applyFilter (std::vector<int> &indices) = 0;

virtual void
applyFilter (PointCloud &output) = 0;

This compiles now with Windows 7 and Visual Studio 2010 (32bit) both in Debug and Release.

Cheers
Marc

@taketwo
Copy link
Member

taketwo commented Jan 16, 2014

@magro11 Great, thanks for helping out with this.

This error was introduced with 8bddcc4, where I tried so get rid of a nasty clang warning, which literally flooded the terminal:

filter_indices.h:186:7: warning: 
      'pcl::FilterIndices<pcl::PointXYZ>::applyFilter' hides overloaded virtual function [-Woverloaded-virtual]
      applyFilter (std::vector<int> &indices) = 0;
      ^

There is a virtual function void applyFilter (PointCloud &output) in pcl::Filter class, but pcl::FilterIndices introduces another virtual function with the same name, but different argument: void applyFilter (std::vector<int> &indices). The problem is that this second function hides the original one, though we actually need both. Therefore I added this using line just to tell the compiler that we do not intend to hide, but rather have both versions. This worked on clang and gcc, but apparently not on Visual Studio.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants