USCiLab / cereal

A C++11 library for serialization
BSD 3-Clause "New" or "Revised" License
4.25k stars 767 forks source link

MSVC error C2064 caused by rapidxml.hpp: syntax errors? #834

Open rjzak opened 3 months ago

rjzak commented 3 months ago

I'm using Cereal via mlpack, and my project compiles fine on Linux, but with Visual Studio, I'm getting a lot of errors in rapidxml.hpp. Specifically:

error C2059: syntax error: '<parameter-list>' [C:\Users\rjzak\CLionProjects\my-project\cmake-build-release\my-project.vcxproj]
  (compiling source file '../src/mycode.cpp')
      C:\Users\rjzak\CLionProjects\my-project\cmake-build-release\vcpkg_installed\x64-windows\include\cereal\external\rapidxml\rapidxml.hpp(398,23):
      the template instantiation context (the oldest one first) is
          C:\Users\rjzak\CLionProjects\my-project\cmake-build-release\vcpkg_installed\x64-windows\include\cereal\external\rapidxml\rapidxml.hpp(392,11):
          while compiling class template 'cereal::rapidxml::memory_pool'

error C2064: term does not evaluate to a function taking 1 arguments [C:\Users\rjzak\CLionProjects\my-project\cmake-build-release\my-project.vcxproj]
  (compiling source file '../src/mycode.cpp')
      C:\Users\rjzak\CLionProjects\my-project\cmake-build-release\vcpkg_installed\x64-windows\include\cereal\external\rapidxml\rapidxml.hpp(598,38):
      'm_alloc_func': function declaration must be available as none of the arguments depend on a template parameter

Going further, it seems MSVC is complaining about invalid tokens before; in typedef void *(alloc_func)(std::size_t);, and that this type does not specify a function which takes one argument.

image

Details:

rjzak commented 2 months ago

I'm not having this issue anymore, and I don't know why. I must have done something stupid.

rjzak commented 2 weeks ago

I'm not sure what to do since this error has resurfaced.