2016-04-21 68 views
1

我想为GLFW编写C++/CLI包装器。我创建了一个名为GLFWWrapper的CLR类库项目,并将glfw3.lib添加到其他依赖项,并将头文件文件夹添加到其他包含目录。为GFLW编写C++/CLI包装器

我GLFWWrapper.h看起来像这样至今:

// GLFWWrapper.h 

#pragma once 

#include <GLFW\glfw3.h> 

using namespace System; 

namespace GLFWWrapper { 

    public ref class Window 
    { 
    public: 
     Window(int width, int height, char * title); 
    private: 
     GLFWwindow * m_ptr; 
    }; 
} 

而且我GLFWWrapper.cpp看起来是这样的:

// This is the main DLL file. 

#include "stdafx.h" 

#include "GLFWWrapper.h" 

namespace GLFWWrapper { 

    Window::Window(int width, int height, char * title) { 
     if (glfwInit() != GL_TRUE) { 

     } 
     else { 
      m_ptr = glfwCreateWindow(width, height, title, nullptr, nullptr); 
     } 
    } 
} 

现在,当我尝试编译它,我得到以下警告:

GLFWWrapper.obj:warning LNK4248:'GLFWwindow'的无法解析的typeref标记(01000008);图像可能无法运行
GLFWWrapper.obj:警告LNK4248:'GLFWmonitor'的无法解析的类型参考标记(0100000B);图像可能无法运行

它们在我的上下文中是什么意思,这可能会产生问题吗?

回答

1

地址:

struct GLFWwindow {}; 
struct GLFWmonitor {}; 

前:

#include <GLFW/glfw3.h> 

至少会消除警告。我没有设置验证它会正确执行,但我认为这很容易为您和其他需要做你正在做的事的人做。