SimpleAmqpClient icon indicating copy to clipboard operation
SimpleAmqpClient copied to clipboard

Support for C++11

Open alanxz opened this issue 12 years ago • 13 comments

Add support for using SimpleAmqpClient when the C++ compiler is in -std=c++11 or -std=c++0x mode.

alanxz avatar Apr 08 '13 18:04 alanxz

I won't assert that this fixes all -std=c++0x compilation issues, but we had to make the following change in SimpleAmqpClient/BasicMessage.h:

Replacing the line

#include <boost/make_shared.hpp>

with:

#ifdef BOOST_HAS_RVALUE_REFS
#undef BOOST_HAS_RVALUE_REFS
#include <boost/make_shared.hpp>
#define BOOST_HAS_RVALUE_REFS
#else
#include <boost/make_shared.hpp>
#endif

thomasmarsh avatar Apr 08 '13 19:04 thomasmarsh

What version of gcc and boost were you using?

alanxz avatar Apr 08 '13 19:04 alanxz

In our case, this fix was for gcc 4.6.3, boost 1.52.0.

thomasmarsh avatar Apr 08 '13 19:04 thomasmarsh

I've just confirmed that this change fixes the particular issue I was having with -std=c++0x on gcc 4.6.3 and boost 1.51.0.

fabiomargarido avatar Apr 08 '13 19:04 fabiomargarido

I should have said in my first post: clearly this is a hack; we haven't had a chance to identify the correct solution.

thomasmarsh avatar Apr 08 '13 19:04 thomasmarsh

I have another work around which works also with boost 1.53.0 and SimpleAmqpClient 2.2.0

#define BOOST_NO_CXX11_RVALUE_REFERENCES #include <SimpleAmqpClient/SimpleAmqpClient.h>

SAbruzzo avatar May 26 '13 16:05 SAbruzzo

@SAbruzzo - what compiler did that workaround work for?

alanxz avatar May 28 '13 06:05 alanxz

@alanxz : silvio@pc:~$ g++ --version g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3

and I use -std=c++0x

SAbruzzo avatar May 28 '13 09:05 SAbruzzo

Workaround for compiling on Mac OS X/Clang under std=c++-11

Add the following cmake flags:

-DCMAKE_CXX_FLAGS="-std=c++-11 -stdlib=libc++ -DGTEST_USE_OWN_TR1_TUPLE=1"

alanxz avatar May 28 '13 16:05 alanxz

Hello Friends ,

I have installed SimpleAmqpClient library in visual studio from nuget package . I have just added header #include <SimpleAmqpClient/SimpleAmqpClient.h> and execute my program then it is showing SSLEAY32.dll missing . Please suggest me what should i do.

Thanks in advance

vikaschamp avatar Nov 09 '17 10:11 vikaschamp

@vikaschamp you likely need to install OpenSSL.

alanxz avatar Nov 14 '17 06:11 alanxz

Unconditionally disabling rvalues for boost::shared_ptr in the library seems like a very bad idea. It seems like it could also lead to ODR violations.

capsocrates avatar May 29 '18 18:05 capsocrates

@capsocrates yup. The path forward here is likely not to enable/disable rvalue references, but to replace boost::shared_ptr with something like std::unique_ptr.

alanxz avatar Jul 08 '18 06:07 alanxz