OpenGL GLFW C程序崩溃

时间:2016-11-06 22:18:00

标签: c opengl glfw glew

我正在尝试在mac上编写一个基本的C OpenGL程序,但它无法编译。代码如下:

#define GLEW_STATIC
#include <GL/glew.h>
#include<GLFW/glfw3.h>

int main()
{
    glfwInit();
    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
    glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
    glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);

    return 0;
}

但是当我运行gcc test.c -o test

时,我收到错误
Undefined symbols for architecture x86_64:
  "_glfwInit", referenced from:
      _main in test-358151.o
  "_glfwWindowHint", referenced from:
      _main in test-358151.o
ld: symbol(s) not found for architecture x86_64

有人可以帮忙吗?

0 个答案:

没有答案