jbrwn / NET-Mapnik

.NET bindings for mapnik
34 stars 12 forks source link

Error "The C++ Standard doesn't provide a hash for this type." when building NETMapnik with Visual Studio 2015 #24

Open petrpokorny opened 8 years ago

petrpokorny commented 8 years ago

Hi, I am trying to build this project on Windows (64bit). I did download and setup all dependencies. However I am getting the following error: "The C++ Standard doesn't provide a hash for this type." It looks like it is caused by external code in vector_tile_backend_pbf.hpp in mapnik-vector-tile project. Is this a known issue and is there solution for it? Or Visual Studio 2015 is not supported yet? (I noticed Visual Studio 2015 RC in requirements)

Thank you!

1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\xstddef(381): error C2338: The C++ Standard doesn't provide a hash for this type.
1>  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\type_traits(522): note: see reference to class template instantiation 'std::hash<_Kty>' being compiled
1>          with
1>          [
1>              _Kty=mapnik::value_adl_barrier::value
1>          ]
1>  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\xutility(264): note: see reference to class template instantiation 'std::is_empty<_Ty1>' being compiled
1>          with
1>          [
1>              _Ty1=std::hash<mapnik::value_adl_barrier::value>
1>          ]
1>  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\unordered_map(23): note: see reference to class template instantiation 'std::_Uhash_compare<_Kty,_Hasher,_Keyeq>' being compiled
1>          with
1>          [
1>              _Kty=mapnik::value_adl_barrier::value,
1>              _Hasher=std::hash<mapnik::value_adl_barrier::value>,
1>              _Keyeq=std::equal_to<mapnik::value_adl_barrier::value>
1>          ]
1>  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\xhash(152): note: see reference to class template instantiation 'std::_Umap_traits<_Kty,_Ty,std::_Uhash_compare<_Kty,_Hasher,_Keyeq>,_Alloc,false>' being compiled
1>          with
1>          [
1>              _Kty=mapnik::value_adl_barrier::value,
1>              _Ty=unsigned int,
1>              _Hasher=std::hash<mapnik::value_adl_barrier::value>,
1>              _Keyeq=std::equal_to<mapnik::value_adl_barrier::value>,
1>              _Alloc=std::allocator<std::pair<const mapnik::value_adl_barrier::value,unsigned int>>
1>          ]
1>  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\unordered_map(86): note: see reference to class template instantiation 'std::_Hash<std::_Umap_traits<_Kty,_Ty,std::_Uhash_compare<_Kty,_Hasher,_Keyeq>,_Alloc,false>>' being compiled
1>          with
1>          [
1>              _Kty=mapnik::value_adl_barrier::value,
1>              _Ty=unsigned int,
1>              _Hasher=std::hash<mapnik::value_adl_barrier::value>,
1>              _Keyeq=std::equal_to<mapnik::value_adl_barrier::value>,
1>              _Alloc=std::allocator<std::pair<const mapnik::value_adl_barrier::value,unsigned int>>
1>          ]
1>  D:\src\Archive\NET-Mapnik\lib\mapnik-vector-tile\src\vector_tile_backend_pbf.hpp(33): note: see reference to class template instantiation 'std::unordered_map<mapnik::value_adl_barrier::value,unsigned int,std::hash<_Kty>,std::equal_to<_Kty>,std::allocator<std::pair<const _Kty,_Ty>>>' being compiled
1>          with
1>          [
1>              _Kty=mapnik::value_adl_barrier::value,
1>              _Ty=unsigned int
1>          ]
jbrwn commented 8 years ago

Or Visual Studio 2015 is not supported yet? (I noticed Visual Studio 2015 RC in requirements)

It is not supported yet. :cry:

I have not had time build this project against VS2015 RTM yet. There is a vs2015-rtm branch and i greatly welcome pull requests if you end up making any progress in this area.

wilhelmberg commented 8 years ago

@petrpokorny FYI I branched off @jbrwn 's vs2015-rtm branch to get latest mapnik working.

https://github.com/jbrwn/NET-Mapnik/compare/vs2015-rtm...BergWerkGIS:vs2015-rtm

Also not working yet as I'm tight on resources and mapnik is moving very fast at the moment. e.g. I think the clipper version needed for mapnik-vector-tile has already changed again since I last worked on it.

Nevertheless you might want to take a look at my branch, to get an idea what is currently needed.

petrpokorny commented 8 years ago

Thanks for hints! I am not c++ developer so it is challenge for me :-) I pulled out the branch and was able to solve some minor problems, mostly in mapnik-vector-tile project and these are pretty nasty hacks.

However now i have a problem with mapnik_map.hpp Map::Render method where the overloaded apply_visitor is not correctly resolved from parameters.

            image_ptr i = image->NativeObject();
            mapnik::request m_req((*_map)->width(), (*_map)->height(), (*_map)->get_current_extent());
            m_req.set_buffer_size(buffer_size);

            agg_renderer_visitor visit(
                *(*_map),
                m_req,
                variables,
                scale_factor,
                offset_x,
                offset_y,
                scale_denominator
            );
                        // THE COMPILER COMPLAINS HERE:
            mapnik::util::apply_visitor(visit, *i);

I think it should resolve to:

template <typename V, typename F>
auto VARIANT_INLINE static apply_visitor(F f, V & v) -> decltype(V::visit(v, f))
{
    return V::visit(v, f);
}

Error messages are:

Severity Code Description Project File Line
Error C2780 'unknown-type mapnik::util::apply_visitor(F,const V &,const V &)': expects 3 arguments - 2 provided NETMapnik D:\src\Archive\NET-Mapnik-VC2015RTM\NETMapnik\mapnik_map.cpp 650
Error C2780 'unknown-type mapnik::util::apply_visitor(F,V &,V &)': expects 3 arguments - 2 provided NETMapnik D:\src\Archive\NET-Mapnik-VC2015RTM\NETMapnik\mapnik_map.cpp 650
Error C2893 Failed to specialize function template 'unknown-type mapnik::util::apply_visitor(F,const V &)' NETMapnik D:\src\Archive\NET-Mapnik-VC2015RTM\NETMapnik\mapnik_map.cpp 650
Error C2893 Failed to specialize function template 'unknown-type mapnik::util::apply_visitor(F,V &)' NETMapnik D:\src\Archive\NET-Mapnik-VC2015RTM\NETMapnik\mapnik_map.cpp 650