不能在NetBeans中包含glut.h

时间:2014-04-21 13:32:39

标签: c++ opengl netbeans

好的,我无法在NetBeans中使用OpenGL。

所以我安装了Cygwin并在此路径中使用了glut.h文件:

C:\cygwin64\usr\include\w32api\GL\glut.h

这是 gl.h 的默认路径,我只添加 glut.h ......

但是当我包含它时,NetBeans说: GL / glut.h中有未解决的包含作为警告,当我运行 glutInit(NULL,NULL); function它返回此错误:

/cygdrive/c/Users/***/Documents/NetBeansProjects/***/main.cpp:8: undefined reference to `glutInit'
/cygdrive/c/Users/***/Documents/NetBeansProjects/***/main.cpp:8:(.text+0x18): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `glutInit'

任何人都知道如何将整个openGL添加到NetBeans的解决方案或完整教程?

1 个答案:

答案 0 :(得分:0)

您必须正确安装过剩,并在项目设置中设置NetBeans中的包含和链接器路径。那里有一个链接器选项和各种构建配置。

Project Properties -> Build -> Linker -> Add Library File

这将有助于解决未定义的引用问题,这个问题基本上是您正在使用的链接器的一些抱怨。

至于包含路径问题,您需要执行以下操作:

Tools -> Options -> C/C++ -> C++ Compiler -> Include Directories

至少,您应该使用NetBeans for starter设置您的软件使用率过剩。