Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make this buildable on Ubuntu 20.04 with GCC 10
...which has doctest 2.3.6, not 2.4.6 that we require. Looks like the visibility rules are more complex (perhaps the operators are auto-picked in GCC 11?), and indeed, GCC 10 requires that extra attribute for visibility tweaking, otherwise we get this: /usr/bin/ld: CMakeFiles/test_schema_node.dir/tests/schema_node.cpp.o: in function `doctest::String doctest::detail::stringifyBinaryExpr<libyang::NodeType, libyang::NodeType>(libyang::NodeType const&, char const*, libyang::NodeType const&)': schema_node.cpp:(.text._ZN7doctest6detail19stringifyBinaryExprIN7libyang8NodeTypeES3_EENS_6StringERKT_PKcRKT0_[_ZN7doctest6detail19stringifyBinaryExprIN7libyang8NodeTypeES3_EENS_6StringERKT_PKcRKT0_]+0x43): undefined reference to `libyang::operator<<(std::ostream&, libyang::NodeType const&)' /usr/bin/ld: schema_node.cpp:(.text._ZN7doctest6detail19stringifyBinaryExprIN7libyang8NodeTypeES3_EENS_6StringERKT_PKcRKT0_[_ZN7doctest6detail19stringifyBinaryExprIN7libyang8NodeTypeES3_EENS_6StringERKT_PKcRKT0_]+0x66): undefined reference to `libyang::operator<<(std::ostream&, libyang::NodeType const&)' This has an easy fix -- just add the LIBYANG_CPP_EXPORT after that function, right (because if it's put before that function, it tries to apply that attribute to the return type, std::string, and emits a warning)? Not so fast, then we have MSVC which chokes on this: libyang-cpp\include\libyang-cpp/Enum.hpp(294,66): error C2144: syntax error: 'int' should be preceded by ';' [build-libyang-cpp\yang-cpp.vcxproj] libyang-cpp\include\libyang-cpp/Enum.hpp(294,84): warning C4091: '__declspec(dllexport)': ignored on left of 'int' when no variable is declared [build-libyang-cpp\yang-cpp.vcxproj] Luckily, I'm not afraid to use these macros. Change-Id: I370d85652542f4c731c6b01b6d7d484d2edbb987
- Loading branch information