Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

C++ lib build Windows VS2022: Build fails with platform toolset v143 – works with platform toolset v142

I am having the following issue with building a simple library (FLANN) from source on windows.

  1. I get the code and use CMAKE to generate the VSSolution. Note
    that I am disabling python, c and matlab bindings. All good so far.
  2. I am using Visual Studio 2022 – Platform toolset v143 C++ ISO 14.

I get the following compile error on the heap.h file:

heap.h(108,50): error C2143: syntax error: missing ',' before '<'

This is the faulting snippet:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

struct CompareT : public std::binary_function<T,T,bool> 
{ 
bool operator()(const T& t_1, const T& t_2) const { return t_2 < t_1; } 
};

NOW, if I change the platform toolset to v142, it works.

I strongly think this is a bug. I am not the best C++ programmer out there and I do not know the nuances on why the same code fails when using v143 instead of v142.

What can I do to fix the code in heap.h so that it will build in v143?

Thank you!

>Solution :

std::binary_function was removed in C++17. The latest version of the library you are building seems to have fixed this problem. So you could upgrade to the latest version (that would be my recommendation) or you could apply the change made to your version of the source.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading