小编kel*_*ron的帖子

在Cygwin下编译最小的GLEW应用程序

让我们考虑以下程序并尝试在Cygwin下编译它:

#include <GL/glut.h>
int main(int argc, char** argv)
{
    glutInit(&argc, argv);
    glLoadIdentity();
}
Run Code Online (Sandbox Code Playgroud)

它编译并运行得很好.-I/usr/include/opengl似乎非常重要.

g++ -I/usr/include/opengl -I../include/cygwin -L../lib/cygwin test.cpp -o test.exe -lglut32 -lglu32 -lglew32 -lopengl32
Run Code Online (Sandbox Code Playgroud)

现在,

#include <GL/glew.h> // from newest NVIDIA SDK
#include <GL/glut.h>
int main(int argc, char** argv)
{
    glewInit();
    glutInit(&argc, argv);
    glLoadIdentity();
}
Run Code Online (Sandbox Code Playgroud)

汇编

g++ -I/usr/include/opengl -I../include/cygwin -L../lib/cygwin test.cpp -o test.exe -lglut32 -lglu32 -lglew32 -lopengl32
Run Code Online (Sandbox Code Playgroud)

失败.如何构建第二个应用程序?

第一

有几种方法可以通过NVIDIA SDK构建glew:VS,cygwin,cygwin和-D_WIN32.我也从源头尝试了cygwin构建的原始glew.

VS build给出了

/cygdrive/c/DOCUME~1/kelebron/LOCALS~1/Temp/ccErbecl.o:test.cpp:(.text+0xa8): undefined reference to `_glLoadIdentity'
collect2: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)

cygwin构建给了很多

../lib/cygwin/glew32.lib(glew.o):glew.c:(.text+0x38e): undefined …
Run Code Online (Sandbox Code Playgroud)

opengl cygwin glew

6
推荐指数
2
解决办法
8628
查看次数

标签 统计

cygwin ×1

glew ×1

opengl ×1