Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing ostream_operators.hpp include header #484

Open
mav5499 opened this issue Apr 14, 2024 · 1 comment
Open

Missing ostream_operators.hpp include header #484

mav5499 opened this issue Apr 14, 2024 · 1 comment

Comments

@mav5499
Copy link

mav5499 commented Apr 14, 2024

Issue

A compilation error occurs when generating IDLs from a type that contains an attribute of another type.

In the example below, it seems like #include <org/eclipse/cyclonedds/util/ostream_operators.hpp> is being included in Measurements.cpp, but not RealType.cpp.

IDLs Used

Measurements.idl

module Measurements
{
    typedef octet NumericGUID[16];
};

RealType.idl

#include "Measurements.idl"

module TestType
{
    struct RealType {
        Measurements::NumericGUID messageIDs;
    };
};

Error Message

The error message is much longer than this, but it gets the point across..

/opt/share/CycloneDDS-CXX/examples/generate-test/build/generated-idls/RealType.cpp: In function ‘std::ostream& TestType::operator<<(std::ostream&, const TestType::RealType&)’:
/opt/share/CycloneDDS-CXX/examples/generate-test/build/generated-idls/RealType.cpp:17:24: error: no match for ‘operator<<’ (operand types are ‘std::basic_ostream<char>’ and ‘const std::array<unsigned char, 16>’)
   os << "messageIDs: " << rhs.messageIDs();
   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
In file included from /opt/share/CycloneDDS-CXX/examples/generate-test/build/generated-idls/Measurements.hpp:13,
                 from /opt/share/CycloneDDS-CXX/examples/generate-test/build/generated-idls/RealType.hpp:12,
                 from /opt/share/CycloneDDS-CXX/examples/generate-test/build/generated-idls/RealType.cpp:9:
/usr/include/c++/8/ostream:108:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>::__ostream_type& (*)(std::basic_ostream<_CharT, _Traits>::__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]’
       operator<<(__ostream_type& (*__pf)(__ostream_type&))
@mav5499 mav5499 changed the title ostream headers Missing ostream_operators.hpp include header Apr 14, 2024
@mav5499
Copy link
Author

mav5499 commented Apr 14, 2024

Attaching the IDLs used and generated cpp types:
generate-test.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant