C++ RTTR-反映库中的现有方法

C++ RTTR-反映库中的现有方法,c++,reflection,C++,Reflection,我正在尝试使用rttr向现有的OpenGL绘图命令添加反射。我使用的是Windows10,而不是2019 这是在我的输入文件中,位于main上方: #include <GL/glew.h> #include <GLFW/glfw3.h> #include <rttr/registration> using namespace rttr; static const GLenum TGL_LINES = GL_LINES; void tBegin(GLenum

我正在尝试使用
rttr
向现有的OpenGL绘图命令添加反射。我使用的是Windows10,而不是2019

这是在我的输入文件中,位于
main
上方:

#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <rttr/registration>

using namespace rttr;

static const GLenum TGL_LINES = GL_LINES;
void tBegin(GLenum mode) {
    glBegin(mode);
}
void tEnd() {
    glEnd();
}
void tVertex2f(float x, float y) {
    glVertex2f(x, y);
}

RTTR_REGISTRATION
{
    using namespace rttr;
    // with registration lines removed, program runs without error
    registration::property_readonly("GL_LINES", &TGL_LINES);
    registration::method("begin", &tBegin);
    registration::method("end", &tEnd);
    registration::method("vertex2f", &tVertex2f);
}

当删除
registration::property\u readonly
registration::method
行时,程序运行没有问题,包括OpenGL。

对不起,我今天刚刚看到你的问题,我以前也没有使用过OpenGL

一,。 你有没有测试过RTTR在2019年是否有效,它说2019年还没有测试过

二,。 在main函数中,是否通过反射调用函数?如果你是。请让我看看。我认为这可能是一个调用问题

我已经了解了方法和函数的定义。 它说,要调用一个方法,就必须这样做。 例如,要以反射方式调用您的tBegin函数,您需要执行以下操作
type::invoke(“begin”,{TGL_LINES})
,第二个参数是您告诉RTTR用于调用tBegin函数的值列表

很抱歉,我现在不能帮我,但我需要更多的信息

Unhandled exception at 0x7677CAA2 (ucrtbase.dll) in glfw-node.exe:
An invalid parameter was passed to a function that considers invalid parameters fatal.