如何解决为什么我需要在代码块中使用 #define 而不是在 Visual Studio 中? (GLFW)
我开始学习 openGL。我更喜欢使用代码块,但 GLFW3 的设置在代码块中很奇怪。我从用于 Visual Studio 的 glfw 文档中复制了示例代码。但是在代码块中,我需要添加额外的行 #define GLFW_DLL
才能使其工作?
#define GLFW_DLL
#include <GLFW/glfw3.h>
#include <iostream>
int main(void)
{
GLFWwindow* window;
/* Initialize the library */
if (!glfwInit())
return -1;
/* Create a windowed mode window and its OpenGL context */
window = glfwCreateWindow(640,480,"Hello World",NULL,NULL);
if (!window)
{
glfwTerminate();
return -1;
}
/* Make the window's context current */
glfwMakeContextCurrent(window);
/* Loop until the user closes the window */
while (!glfwWindowShouldClose(window))
{
/* Render here */
glClear(GL_COLOR_BUFFER_BIT);
/* Swap front and back buffers */
glfwSwapBuffers(window);
/* Poll for and process events */
glfwPollEvents();
}
glfwTerminate();
return 0;
}
那么为什么我需要在代码块中而不是在 Visual Studio 中添加额外的 #define 行才能使其工作? 我遵循了 this 说明
GLFW 文档示例代码 here
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。