flann-lib / flann

Fast Library for Approximate Nearest Neighbors
http://people.cs.ubc.ca/~mariusm/flann
Other
2.22k stars 649 forks source link

Flann Throws Error Regarding "pop_t': Identifier not found in dist.h file #386

Open mdmorar opened 6 years ago

mdmorar commented 6 years ago

Hi,

I am using VCPKG to install packages on my windows machine for Visual Studio 2017. I was working with the previous versions of PCL 1.8.0. There is a flann component somewhere apart of this library which uses the flann library as a prerequisite to do a nearest neighbor search for a kdtree.

I have just upgraded to the current version of PCL 1.8.1 as well as OpenCV 3.4.1 which also has a flann plugin associated with it. Regardless, my C++ program will not compile due to the value "pop_t" which cannot be found for some reason.

image

image

I suspect this is a bug, but am on a strict deadline of next week with this. I am on version Flann v1.9.1-7 at the moment but was probably on the previous 1.8.5 version. I am not too sure about the previous version. Please help me resolve this quickly.

Thanks for your help.

Monil

mdmorar commented 6 years ago

In order to fix the issues and get my program and the PCL libraries working correctly I had to move the "typedef unsigned long long pop_t;" outside the #if and #else so that either one will use the parameter to do the math. I don't know if this was the intent of this code but in order to progress in my software application I needed this error fixed. Please fix this as soon as possible and let me know so I can just update the flann and not worry about it.

Cheers.

elliottzheng commented 6 years ago

@mdmorar Hi, I met the same problem as you. It wouldn't happen before my updating visual studio 2017. Since I'm using the same pcl setting before and after the problem happens, I guess it may be the update of visual studio to blame.

RDCH106 commented 6 years ago

The same problem described by @mdmorar but I am not using VCPKG, I manage PCL and its dependencies manually:

error C3861: 'pop_t': identifier not found
mdmorar commented 6 years ago

What I did to make it start working until the next iteration of this codebase is the following: I took the above images "typedef unsigned long long pop_t;" and moved it outside the #define preprocessor definition statements. This way it would instantiate it regardless of #if or #else. For now this should get you guys up and running. I really hope they fix this. This should work regardless of visual studio version in my opinion as its apart of alot of open source VCPKG libraries that depend on it.

Hope this helps.

RDCH106 commented 6 years ago

Yes!

I have applied similar solution using yours as base solution.

Thanks you for sharing

Evan0327 commented 5 years ago

Hello, I got the same problem with PCL, but it seems impossible to modify the dist.h file

drfknoble commented 5 years ago

If FLANN is installed in either Program Files or Program Files (x86), you'll need to run Visual Studio as an Administrator. Program Files and Program Files (x86) are protected and need elevated permissions to edit any of the directories' contents. Hope it helps. I just tried @mdmorar 's fix and it worked for me too.

Evan0327 commented 5 years ago

If FLANN is installed in either Program Files or Program Files (x86), you'll need to run Visual Studio as an Administrator. Program Files and Program Files (x86) are protected and need elevated permissions to edit any of the directories' contents. Hope it helps. I just tried @mdmorar 's fix and it worked for me too.

Thank you very much DrFrazerNobel, I solved the problem.

MicheleBe commented 5 years ago

I had the same issue and I solve in the same way, moving the definition before the #if

HuQingsheng520 commented 5 years ago

Hi, I got the same problem with PCL 1.9.1 for Visual Studio 2017, but when I took the above images "typedef unsigned long long pop_t;" and moved it outside the #define preprocessor definition statements.It made a new mistake.

sheikware commented 4 years ago

Late to the game here, but that section just needs to drop sizeof(pop_t) or you get a memory issue. OpenCV has the correct fix in its local implementation.

    HammingLUT lut;
    result = lut(reinterpret_cast<const unsigned char*> (a),
                 reinterpret_cast<const unsigned char*> (b), size);
AI-ML-Enthusiast commented 4 years ago

@mdmorar Would you specially mention the line number please, where will move the line "typedef unsigned long long pop_t;"

liuchangji commented 4 years ago

move the "typedef unsigned long long pop_t;" to lines 475 is ok

@mdmorar Would you specially mention the line number please, where will move the line "typedef unsigned long long pop_t;"

JACKDONG-blue commented 3 years ago

Hi, I got the same problem with PCL 1.9.1 for Visual Studio 2017, but when I took the above images "typedef unsigned long long pop_t;" and moved it outside the #define preprocessor definition statements.It made a new mistake.

me,too. How do you solve it?

Osyotr commented 3 years ago

Is project dead? See https://github.com/opencv/opencv/pull/13270

JACKDONG-blue commented 3 years ago

Is project dead? See opencv/opencv#13270 There are still the same mistakes after I corrected them.

JackBoosY commented 3 years ago

Related https://github.com/microsoft/vcpkg/issues/19170#issuecomment-887966840.