Я пытаюсь установить библиотеки qpid proton 0.14.0 в систему SUSE linux, чтобы интегрировать обмен сообщениями AMQP в большую программу на c ++. Установка требует вызова «cmake» и «make all». После вызова «make all» сборка завершается на 32%, а затем выдает ошибки:
Scanning dependencies of target qpid-proton-cpp
[ 32%] Building CXX object proton-c/bindings/cpp/CMakeFiles/qpid-proton-cpp.dir/src/connection.cpp.o
In file included from {Install_dir}/proton-c/bindings/cpp/include/proton/./././link.hpp:31,
from {Install_dir}/proton-c/bindings/cpp/include/proton/././receiver.hpp:27,
from {Install_dir}/proton-c/bindings/cpp/include/proton/./session.hpp:27,
from {Install_dir}/proton-c/bindings/cpp/include/proton/connection.hpp:28,
from {Install_dir}/proton-c/bindings/cpp/src/connection.cpp:24:
{Install_dir}/proton-c/bindings/cpp/include/proton/././././sender_options.hpp:87: error: declaration of ‘proton::sender_options& proton::sender_options::delivery_mode(proton::delivery_mode)’
{Install_dir}/proton-c/bindings/cpp/include/proton/./././././delivery_mode.hpp:30: error: changes meaning of ‘delivery_mode’ from ‘struct proton::delivery_mode’
In file included from {Install_dir}/proton-c/bindings/cpp/include/proton/./././link.hpp:32,
from {Install_dir}/proton-c/bindings/cpp/include/proton/././receiver.hpp:27,
from {Install_dir}/proton-c/bindings/cpp/include/proton/./session.hpp:27,
from {Install_dir}/proton-c/bindings/cpp/include/proton/connection.hpp:28,
from {Install_dir}/proton-c/bindings/cpp/src/connection.cpp:24:
{Install_dir}/proton-c/bindings/cpp/include/proton/././././receiver_options.hpp:83: error: declaration of ‘proton::receiver_options& proton::receiver_options::delivery_mode(proton::delivery_mode)’
{Install_dir}/proton-c/bindings/cpp/include/proton/./././././delivery_mode.hpp:30: error: changes meaning of ‘delivery_mode’ from ‘struct proton::delivery_mode’
make[2]: *** [proton-c/bindings/cpp/CMakeFiles/qpid-proton-cpp.dir/src/connection.cpp.o] Error 1
make[1]: *** [proton-c/bindings/cpp/CMakeFiles/qpid-proton-cpp.dir/all] Error 2
make: *** [all] Error 2
Изучение «изменения значения« delivery_mode »по сравнению с« struct proton :: delivery_mode »приводит меня к убеждению, что это проблема, связанная с функцией конструктора, имеющей то же имя, что и структура. Любые мысли о том, как я могу получить эти библиотеки для установки? Спасибо!
namespace proton {
/// The message delivery policy to establish when opening a link.
/// This structure imitates the newer C++11 "enum class" so that
/// The enumeration constants are in the delivery_mode namespace.
struct delivery_mode {
/// Delivery modes
enum modes {
/// No set policy. The application must settle messages
/// itself according to its own policy.
NONE = 0,
/// Outgoing messages are settled immediately by the link.
/// There are no duplicates.
AT_MOST_ONCE,
/// The receiver settles the delivery first with an
/// accept/reject/release disposition. The sender waits to
/// settle until after the disposition notification is
/// received.
AT_LEAST_ONCE
};
/// @cond INTERNAL
delivery_mode() : modes_(NONE) {}
delivery_mode(modes m) : modes_(m) {}
operator modes() { return modes_; }
/// @endcond
private:
modes modes_;
};
}
Это проблема с версией GCC. Некоторые версии GCC рассматривают эту ситуацию как ошибку, и вы должны использовать одну из этих версий. Одним из решений является устранение неоднозначности путем конкретной ссылки на тип proton::delivery_mode
, У меня также была проблема со сборкой тестов взаимодействия, которую я исправил. Я все еще не могу создать привязки Python, которые я хочу, но сам Proton строит с изменениями ниже. Я обновлю этот ответ, если выясню проблему с привязками Python.
diff --git a/proton-c/bindings/cpp/include/proton/receiver_options.hpp b/proton-c/bindings/cpp/include/proton/receiver_options.hpp
index 413e4d4..111865d 100644
--- a/proton-c/bindings/cpp/include/proton/receiver_options.hpp
+++ b/proton-c/bindings/cpp/include/proton/receiver_options.hpp
@@ -70,7 +70,7 @@ class receiver_options {
PN_CPP_EXTERN receiver_options& handler(class messaging_handler&);
/// Set the delivery mode on the receiver.
- PN_CPP_EXTERN receiver_options& delivery_mode(delivery_mode);
+ PN_CPP_EXTERN receiver_options& delivery_mode(proton::delivery_mode);
/// Automatically accept inbound messages that aren't otherwise
/// released, rejected, or modified (default is true).
diff --git a/proton-c/bindings/cpp/include/proton/sender_options.hpp b/proton-c/bindings/cpp/include/proton/sender_options.hpp
index 9d7bb42..58a42cb 100644
--- a/proton-c/bindings/cpp/include/proton/sender_options.hpp
+++ b/proton-c/bindings/cpp/include/proton/sender_options.hpp
@@ -74,7 +74,7 @@ class sender_options {
PN_CPP_EXTERN sender_options& handler(class messaging_handler&);
/// Set the delivery mode on the sender.
- PN_CPP_EXTERN sender_options& delivery_mode(delivery_mode);
+ PN_CPP_EXTERN sender_options& delivery_mode(proton::delivery_mode);
/// Automatically settle messages (default is true).
PN_CPP_EXTERN sender_options& auto_settle(bool);
diff --git a/proton-c/bindings/cpp/src/interop_test.cpp b/proton-c/bindings/cpp/src/interop_test.cpp
index de6ae63..a383b26 100644
--- a/proton-c/bindings/cpp/src/interop_test.cpp
+++ b/proton-c/bindings/cpp/src/interop_test.cpp
@@ -33,6 +33,7 @@ namespace {
using namespace std;
using namespace proton;
+using proton::codec::get;
using proton::codec::encoder;
using proton::codec::decoder;
Других решений пока нет …