vendredi 27 novembre 2020

missing ';' before 'boost::interprocess::offset_t' and missing type specifier - int assumed (boost 1.74.0, Visual Studio 2013) [duplicate]

I have an issue compiling code for a c++ project using the boost library. Everything works as expected with Visual Studio 2019, however, I also need this to work with Visual Studio 2013 in another branch of the same product.

Here's an example header (redacted):

#pragma once

#include <boost/interprocess/managed_windows_shared_memory.hpp>
#include <boost/interprocess/sync/interprocess_condition.hpp>
#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/interprocess/containers/vector.hpp>
#include <boost/interprocess/containers/string.hpp>
#include <boost/container/scoped_allocator.hpp>
#include <boost/interprocess/allocators/allocator.hpp>
#include <boost/range/algorithm/find.hpp>
#include <memory>
#include <string>

#include <REDACTED.h>
#include <REDACTED2.h>

static constexpr boost::interprocess::offset_t SHARED_MEMORY_SIZE_IN_BYTES = 300000;

Compiling this in visual studio 2019 works without problems. But with 2013, I get the following:

error C2143: syntax error : missing ';' before 'boost::interprocess::offset_t' error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

Can someone explain to be what could go wrong in this case? Is boost incompatible with vs13? It is a header-only library, so I've simply used the same header files in both 2019 and 2013 versions of the product.

Another stack overflow question: Boost includes wreaks havoc - but it's not Boost's fault mentions that the order of the headers might be at fault, so I tried moving about my REDACTED.h and REDACTED2.h, but the error still occurs.

Another question: Building boost with Visual Studio 2013 (Express) mentions that there's been bugs in boost 1.55 related to visual studio 2013, but that they should be fixed. I assume 1.74.0 should include such fixes, but perhaps I need to apply some patch to 1.74.0 headers too, to get this working?

Aucun commentaire:

Enregistrer un commentaire