admin管理员组文章数量:1125322
I am attempting to use activemq-cpp within my Go application.
I have cloned the activemq-cpp repo and followed all the instructions to install it on my machine.
I have created a .cpp wrapper that allows me to import it using Go which I can call successfully.
Here is the wrapper
#include <activemq/core/ActiveMQConnectionFactory.h>
#include <activemq/library/ActiveMQCPP.h>
#include <cms/Connection.h>
#include <cms/Session.h>
#include <cms/Destination.h>
#include <cms/MessageProducer.h>
#include <cms/TextMessage.h>
#include <decaf/lang/System.h>
#include <iostream>
#include <memory>
#include <string>
extern "C" {
// Initialize ActiveMQ library
void ActiveMQCPPInitializeLibrary() {
activemq::library::ActiveMQCPP::initializeLibrary();
}
// Shutdown ActiveMQ library
void ActiveMQCPPShutdownLibrary() {
activemq::library::ActiveMQCPP::shutdownLibrary();
}
// Create a connection to ActiveMQ
void* CreateConnection(const char* brokerURI) {
try {
decaf::lang::System::setProperty( "decaf.ssl.disablePeerVerification", "true" );
auto factory = std::make_unique<activemq::core::ActiveMQConnectionFactory>(brokerURI);
cms::Connection* connection = factory->createConnection();
return (void*)connection;
} catch (const cms::CMSException& e) {
std::cerr << "CMSException: " << e.getMessage() << std::endl;
return nullptr;
}
}
Which I build with
g++ -I. -shared -o libactivemq_wrapper.so -fPIC activemq_wrapper.cpp
I have the .h
files in the root directory alongside my .cpp wrapper, I have the headers for activemq, cms and decaf.
The issue I'm having is when I try and add this line
decaf::lang::System::setProperty( "decaf.ssl.disablePeerVerification", "true" );
With the import #include <decaf/lang/System.h>
This then leads to the compiler erroring with
/decaf/internal/AprPool.h:39:17: error: ‘apr_pool_t’ does not name a type; did you mean ‘AprPool’?
39 | mutable apr_pool_t* aprPool;
| ^~~~~~~~~~
| AprPool
./decaf/internal/AprPool.h:55:9: error: ‘apr_pool_t’ does not name a type; did you mean ‘AprPool’?
55 | apr_pool_t* getAprPool() const;
| ^~~~~~~~~~
| AprPool
./decaf/internal/AprPool.h:68:16: error: ‘apr_pool_t’ does not name a type; did you mean ‘AprPool’?
68 | static apr_pool_t* getGlobalPool();
| ^~~~~~~~~~
| AprPool
I have installed APR locally with sudo apt-get install apache2-dev libapr1-dev libaprutil1-dev
but I'm getting the same compiler issue. I'm a bit lost with this as I'm quite new to C++
I am attempting to use activemq-cpp within my Go application.
I have cloned the activemq-cpp repo https://github.com/apache/activemq-cpp and followed all the instructions to install it on my machine.
I have created a .cpp wrapper that allows me to import it using Go which I can call successfully.
Here is the wrapper
#include <activemq/core/ActiveMQConnectionFactory.h>
#include <activemq/library/ActiveMQCPP.h>
#include <cms/Connection.h>
#include <cms/Session.h>
#include <cms/Destination.h>
#include <cms/MessageProducer.h>
#include <cms/TextMessage.h>
#include <decaf/lang/System.h>
#include <iostream>
#include <memory>
#include <string>
extern "C" {
// Initialize ActiveMQ library
void ActiveMQCPPInitializeLibrary() {
activemq::library::ActiveMQCPP::initializeLibrary();
}
// Shutdown ActiveMQ library
void ActiveMQCPPShutdownLibrary() {
activemq::library::ActiveMQCPP::shutdownLibrary();
}
// Create a connection to ActiveMQ
void* CreateConnection(const char* brokerURI) {
try {
decaf::lang::System::setProperty( "decaf.net.ssl.disablePeerVerification", "true" );
auto factory = std::make_unique<activemq::core::ActiveMQConnectionFactory>(brokerURI);
cms::Connection* connection = factory->createConnection();
return (void*)connection;
} catch (const cms::CMSException& e) {
std::cerr << "CMSException: " << e.getMessage() << std::endl;
return nullptr;
}
}
Which I build with
g++ -I. -shared -o libactivemq_wrapper.so -fPIC activemq_wrapper.cpp
I have the .h
files in the root directory alongside my .cpp wrapper, I have the headers for activemq, cms and decaf.
The issue I'm having is when I try and add this line
decaf::lang::System::setProperty( "decaf.net.ssl.disablePeerVerification", "true" );
With the import #include <decaf/lang/System.h>
This then leads to the compiler erroring with
/decaf/internal/AprPool.h:39:17: error: ‘apr_pool_t’ does not name a type; did you mean ‘AprPool’?
39 | mutable apr_pool_t* aprPool;
| ^~~~~~~~~~
| AprPool
./decaf/internal/AprPool.h:55:9: error: ‘apr_pool_t’ does not name a type; did you mean ‘AprPool’?
55 | apr_pool_t* getAprPool() const;
| ^~~~~~~~~~
| AprPool
./decaf/internal/AprPool.h:68:16: error: ‘apr_pool_t’ does not name a type; did you mean ‘AprPool’?
68 | static apr_pool_t* getGlobalPool();
| ^~~~~~~~~~
| AprPool
I have installed APR locally with sudo apt-get install apache2-dev libapr1-dev libaprutil1-dev
but I'm getting the same compiler issue. I'm a bit lost with this as I'm quite new to C++
1 Answer
Reset to default 0To fix this I ran the below on the terminal
find /usr/include -name apr_pools.h
Which returned /usr/include/apr-1.0/apr_pools.h
To get the location where APR is installed and then added it as a include to the g++
command via the -I
flag
g++ -I/usr/include/apr-1.0 -I. -shared -o libactivemq_wrapper.so -fPIC activemq_wrapper.cpp
本文标签: cerror aprpoolt’ does not name a type did you mean AprPool’Stack Overflow
版权声明:本文标题:c++ - error: ‘apr_pool_t’ does not name a type; did you mean ‘AprPool’? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736657263a1946286.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论