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

Build problem with cyclonedds-cxx and GoogleTest #518

Open
LarsStensen opened this issue Nov 7, 2024 · 0 comments
Open

Build problem with cyclonedds-cxx and GoogleTest #518

LarsStensen opened this issue Nov 7, 2024 · 0 comments

Comments

@LarsStensen
Copy link

I have been having some problems using cyclonedds-cxx together with GoogleTest in a project. With the cyclonedds header dds.hpp included, the build will produce a long list of errors:

home/lars/.conan2/p/gtest9d46f8e38a173/p/include/gtest/gtest-printers.h:290:36: error: no matching function for call to ‘testing::internal::internal_stream_operator_without_lexical_name_lookup::StreamPrinter::PrintValue(const zoom::Frame&, std::nullptr_t)’
  290 |     T, decltype(Printer::PrintValue(std::declval<const T&>(), nullptr)),
      |                 ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/lars/.conan2/p/gtest9d46f8e38a173/p/include/gtest/gtest-printers.h:213:15: note: candidate: ‘template<class T, class, class> static void testing::internal::internal_stream_operator_without_lexical_name_lookup::StreamPrinter::PrintValue(const T&, std::ostream*)’
  213 |   static void PrintValue(const T& value, ::std::ostream* os) {
      |               ^~~~~~~~~~
/home/lars/.conan2/p/gtest9d46f8e38a173/p/include/gtest/gtest-printers.h:213:15: note:   template argument deduction/substitution failed:
/home/lars/.conan2/p/gtest9d46f8e38a173/p/include/gtest/gtest-printers.h:212:33: error: no match for ‘operator<<’ (operand types are ‘std::basic_ostream<char>’ and ‘const zoom::Frame’)
  211 |             typename = decltype(std::declval<std::ostream&>()
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  212 |                                 << std::declval<const T&>())>
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/10/bits/unique_ptr.h:42,
                 from /usr/include/c++/10/memory:83,
                 from /home/lars/.conan2/p/gtest9d46f8e38a173/p/include/gmock/gmock-actions.h:139,
                 from /home/lars/.conan2/p/gtest9d46f8e38a173/p/include/gmock/gmock.h:56,
                 from /home/lars/source/personal/cyclonedds_gtest_fail/test_main.cpp:1:

(this goes on for a while)

When the dds.hpp include is removed from the file, the code builds without error.

Code:

#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "dds/dds.hpp"
namespace zoom{
class Frame {
public:
Frame(){}
};
}

class MockFrame
{
public:
    MOCK_METHOD(int, Call, (const zoom::Frame&), ());
};


int main(int argc, char** argv)
{
    ::testing::InitGoogleTest(&argc, argv);
    return RUN_ALL_TESTS();
}

I am building with cyclonedds and cyclonedds-cxx 0.10.5 and gtest 1.12.1

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