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

compiler error with DBSCAN code when using GCC 4 #84

Closed
twongjirad opened this issue Jan 5, 2017 · 6 comments
Closed

compiler error with DBSCAN code when using GCC 4 #84

twongjirad opened this issue Jan 5, 2017 · 6 comments
Assignees
Labels

Comments

@twongjirad
Copy link
Member

twongjirad commented Jan 5, 2017

found by @drinkingkazu

initially show in Issue #82

But I do get a compiler error that looks like a compiler version issue while building DBSCANN algorithm:

In file included from DBSCANAlgo.cxx:3:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/algorithm:62:
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_algo.h:2263:11: error: no matching function for call to object of type 'mycompare_t'
while (__comp(*__first, __pivot))
^~
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_algo.h:2296:19: note: in instantiation of function template specialization
'std::__unguarded_partition<__gnu_cxx::__normal_iterator<std::pair<int, double> *, std::vector<std::pair<int, double>, std::allocator<std::pair<int, double> > > >,
std::pair<int, double>, mycompare_t>' requested here
return std::__unguarded_partition(__first + 1, __last, *__first, __comp);
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_algo.h:2337:11: note: in instantiation of function template specialization
'std::__unguarded_partition_pivot<__gnu_cxx::__normal_iterator<std::pair<int, double> *, std::vector<std::pair<int, double>, std::allocator<std::pair<int, double> > > >,
mycompare_t>' requested here
std::__unguarded_partition_pivot(__first, __last, __comp);
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_algo.h:5498:9: note: in instantiation of function template specialization
'std::__introsort_loop<__gnu_cxx::__normal_iterator<std::pair<int, double> *, std::vector<std::pair<int, double>, std::allocator<std::pair<int, double> > > >, long,
mycompare_t>' requested here
std::__introsort_loop(__first, __last,
^
DBSCANAlgo.cxx:264:12: note: in instantiation of function template specialization 'std::sort<__gnu_cxx::__normal_iterator<std::pair<int, double> *, std::vector<std::pair<int,
double>, std::allocator<std::pair<int, double> > > >, mycompare_t>' requested here
std::sort( hitlist.begin(), hitlist.end(), mycompare );
^
DBSCANAlgo.cxx:221:12: note: candidate function not viable: 2nd argument ('const std::pair<int, double>') would lose const qualifier
bool operator() ( std::pair<int,double>& lhs, std::pair<int,double>& rhs ) {
^
In file included from DBSCANAlgo.cxx:3:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/algorithm:62:

@twongjirad
Copy link
Member Author

found by @vgenty

Same result as above on develop with GCC 4.8.4 on ubuntu 14.04.5

https://goo.gl/Uj8ZCE

@twongjirad
Copy link
Member Author

moved struct outside of the function. @vgenty, @drinkingkazu does this help?

@vgenty
Copy link
Member

vgenty commented Jan 5, 2017

Similar result...
https://goo.gl/AztwSK

@twongjirad
Copy link
Member Author

How about now? The comparison operator is pass by copy now.

@vgenty
Copy link
Member

vgenty commented Jan 5, 2017

Yes, build is fine now

@twongjirad
Copy link
Member Author

Thanks!

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

No branches or pull requests

2 participants