build errors from group__DDSTopicExampleModule.htm

5 posts / 0 new
Last post
Offline
Last seen: 3 years 2 months ago
Joined: 02/08/2021
Posts: 6
build errors from group__DDSTopicExampleModule.htm

Hi there

I am struggling. ALL I want is to list the topics in a domain, really I dont think that should be difficult. But it seems no one else on the planet wants to do it, or at least the documentation gives zero hints.

 

However I found https://community.rti.com/static/documentation/connext-dds/current/doc/api/connext_dds/api_cpp2/group__DDSTopicExampleModule.html

At the top is suggests...

The following #includes are needed for the examples on this page

#include <dds/domain/ddsdomain.hpp>
#include <dds/core/ddscore.hpp>
#include <dds/topic/ddstopic.hpp>
 
 
So I added them and when I hit the compile I get
Libraries/rti_connext_dds-6.0.0/include/ndds/hpp/rti/core/Vector.hpp:64:32: error: could not convert ‘{1, 0, 0, 0, 0, 29508, 0, 0, {1, 0, 1}, {1, 1}, 2147483647}’ from ‘<brace-enclosed initializer list>’ to ‘const NativeSeq’ {aka ‘const DDS_OctetSeq’}

What the devil is this all about? Compiler errors in the core hpp files? Really? I assume that someone else has managed to use the 'modern c++' stuff or am I the only daft beggar who has tried? Surely not? If not then perhaps somewhere in the documentation might be a hint as to how to get a normal gcc compiler to compile this without a total barf.
 
I sound a bit grumpy but having spent 4 days so far on this trivial task I am very grumpy and for that I should appologize but there are times I wonder why people make such trivial things so impossible.
 
 
Offline
Last seen: 6 days 2 hours ago
Joined: 04/02/2013
Posts: 195

Can you share what part of your code is failing?

I just tried this:

 

#include"Foo.hpp"

#include<dds/domain/ddsdomain.hpp>
#include<dds/core/ddscore.hpp>
#include<dds/topic/ddstopic.hpp>

int main()
{
dds::domain::DomainParticipant participant1(1);
dds::topic::Topic<Foo> topic1(participant1, "Topic1");
dds::topic::Topic<Foo> topic2(participant1, "Topic2");
dds::topic::Topic<Foo> topic3(participant1, "Topic3");

std::vector<dds::topic::TopicBuiltinTopicData> topic_data1;
dds::topic::discover_topic_data(participant1, std::back_inserter(topic_data1));

for (const auto &data : topic_data1) {
  std::cout << data.name() << std::endl;
}
}
 
and it works fine, printing:
 

Topic1
Topic2
Topic3

Offline
Last seen: 3 years 2 months ago
Joined: 02/08/2021
Posts: 6

The includes are failing fo me, as in not even compiling  (see question). What compiler are you using? Where did you get the header files?

I dont have a foo.hpp, I am still just using octets type for the moment as I am just trying to prove a point.

 

Offline
Last seen: 6 days 2 hours ago
Joined: 04/02/2013
Posts: 195

Can you share your source file?

Offline
Last seen: 6 days 2 hours ago
Joined: 04/02/2013
Posts: 195

I suspect you're mixing the Traditional C++ and Modern C++ APis in the same source file, which is not allowed.

See https://community.rti.com/kb/how-do-i-use-traditional-c-and-modern-c-apis-same-application