rttrorg / rttr

C++ Reflection Library
https://www.rttr.org
MIT License
3.11k stars 429 forks source link

Undefined symbols when use as static library. #367

Open charlietsao opened 8 months ago

charlietsao commented 8 months ago

Platform: OSX IDE: Version 14.3 (14E222b)

CMake Options are:

option(BUILD_RTTR_DYNAMIC "Build the dynamic/shared version of RTTR library" OFF)
option(BUILD_UNIT_TESTS "Build the unit tests of RTTR" OFF)
option(BUILD_STATIC "Build RTTR as static library" ON)
option(BUILD_WITH_STATIC_RUNTIME_LIBS "Link against the static runtime libraries" OFF)
option(BUILD_WITH_RTTI "Enable build with C++ runtime type information for compilation" OFF)
option(BUILD_BENCHMARKS "Enable this to build the benchmarks" OFF)
option(BUILD_EXAMPLES "Enable this to build the examples" OFF)
option(BUILD_DOCUMENTATION "Enable this to build the documentation" OFF)
option(BUILD_INSTALLER "Enable this to build the installer" OFF)
option(BUILD_PACKAGE "Enable this to build the installer" OFF)
option(USE_PCH "Use precompiled header files for compilation" OFF)

Build as static library then used in another project, errors are:

Undefined symbols for architecture x86_64:
  "typeinfo for rttr::detail::method_wrapper_base", referenced from:
      typeinfo for rttr::detail::method_wrapper<void (LabNode::*)(), LabNode, (rttr::access_levels)0, rttr::detail::default_invoke, rttr::detail::default_args<>, rttr::detail::parameter_infos<>, 0ul, rttr::type_list<>> in GeneralMesh.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)