Windows下编译RTTR

C++11引入了RTTI、Metaprogramming 等技术,但C++在Reflection编程方面依旧功能有限。在社区上,RTTR则提供了一套C++编写的反射库,补充了C++在Reflection方面的缺陷。

零、环境

|---------------|------------------------------|
| 操作系统 | Windows 11 |
| Visual Studio | Visual Studio Community 2022 |
| CMake | CMake 3.24.2 |
| Doxygen | Doxygen-1.9.8 |

一、下载源码

从GitHub拉取RTTR代码:

复制代码
git clone https://github.com/rttrorg/rttr.git

二、编译

按照下表配置CMake,并完成构建与生成,

|---------------------------------|------------------------------|
| Where is the source code | Windows 11 |
| Where to build the binaries | Visual Studio Community 2022 |
| CMAKE_INSTALL_PREFIX | CMake 3.24.2 |

打开rttr.sln,构建"ALL_BUILD"完成RTTR编译;构建"INSTALL"完成RTTR安装。

网络资料

Reflectionhttps://en.wikipedia.org/wiki/Reflection_%28computer_programming%29

The C++ Extensions for Reflection https://en.cppreference.com/w/cpp/experimental/reflect

RTTRhttps://www.rttr.org/QMetaObjecthttps://doc.qt.io/qt-5/qmetaobject.html

An Introduction to Reflection in C++https://blog.csdn.net/qq_26221775/article/details/138768568?spm=1001.2014.3001.5501

FreeCAD: C++ Generic Factory Method inteface advicehttps://forum.freecad.org/viewtopic.php?p=24221&hilit=BaseClass#p24221

相关推荐
水饺编程3 小时前
第5章,[标签 Win32] :获取设备环境的信息
c语言·c++·windows·visual studio
yuanpan5 小时前
Python 调用 DLL 动态库入门:Windows 下调用 C++ 与 C# 动态库完整示例
c++·windows·python
张赐荣5 小时前
一键禁用 Ctrl+Alt+Shift+Windows 打开 Office 全局快捷键实用工具
windows
鸽芷咕5 小时前
【已解决】Claude Code 报错“claude.exe 与 Windows 不兼容“的解决方法
windows·claude
bike兔兔5 小时前
Python实现CSV文件转Excel,一键格式转换办公小脚本
开发语言·windows·python
kyle-fang6 小时前
langchain各类文档加载
windows·python·langchain
徐健峰7 小时前
Claude Code 国内不稳定?OpenAI Codex CLI 完全替代指南(Windows 版,2026)
windows
2401_827560207 小时前
【电脑和手机系统】win11镜像离线修复命令(六)
windows
minxihou7 小时前
Windows 11 OpenSSH Server 完整排错指南(微软账号场景)
windows·microsoft·ssh·openssh·troubleshooting·windowswsl2
公子小六7 小时前
基于.NET的Windows窗体编程之WinForms数据表格
windows·c#·.net·winforms