Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/139.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 如何运行一个基本的;“你好,世界”;windows中的GLSL程序?_C++_Windows_Opengl_Windows 7_Glut - Fatal编程技术网

C++ 如何运行一个基本的;“你好,世界”;windows中的GLSL程序?

C++ 如何运行一个基本的;“你好,世界”;windows中的GLSL程序?,c++,windows,opengl,windows-7,glut,C++,Windows,Opengl,Windows 7,Glut,我正在尝试从运行GLSL程序,并得到如下错误。除了opengl,我需要安装哪些基本库?我需要这个在Windows机器上 main.cpp:72:30: error: 'GLchar' does not name a type main.cpp:72:38: warning: ISO C++ forbids declaration of 'vShaderFile' with no type [-fpermissive] main.cpp:72:57: error: 'GLchar' does no

我正在尝试从运行GLSL程序,并得到如下错误。除了opengl,我需要安装哪些基本库?我需要这个在Windows机器上

main.cpp:72:30: error: 'GLchar' does not name a type
main.cpp:72:38: warning: ISO C++ forbids declaration of 'vShaderFile' with no type [-fpermissive]
main.cpp:72:57: error: 'GLchar' does not name a type
main.cpp:72:65: warning: ISO C++ forbids declaration of 'fShaderFile' with no type [-fpermissive]
main.cpp: In function 'void initShader(const int*, const int*)':
main.cpp:75:5: error: 'GLchar' was not declared in this scope
main.cpp:75:13: error: 'vSource' was not declared in this scope
main.cpp:75:23: error: 'fSource' was not declared in this scope
main.cpp:80:43: error: cannot convert 'const int*' to 'const char*' for argument '1' to 'char* readShaderSource(const char*)'
main.cpp:83:43: error: cannot convert 'const int*' to 'const char*' for argument '1' to 'char* readShaderSource(const char*)'
main.cpp:88:30: error: 'GL_VERTEX_SHADER' was not declared in this scope
main.cpp:88:46: error: 'glCreateShader' was not declared in this scope
main.cpp:89:30: error: 'GL_FRAGMENT_SHADER' was not declared in this scope
main.cpp:90:31: error: 'glCreateProgram' was not declared in this scope
main.cpp:94:36: error: 'glAttachShader' was not declared in this scope
main.cpp:99:39: warning: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
main.cpp:99:39: warning: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
main.cpp:99:33: error: expected primary-expression before 'const'
main.cpp:99:33: error: expected ')' before 'const'
main.cpp:100:39: warning: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
main.cpp:100:39: warning: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
main.cpp:100:33: error: expected primary-expression before 'const'
main.cpp:100:33: error: expected ')' before 'const'
main.cpp:104:28: error: 'glCompileShader' was not declared in this scope
main.cpp:109:28: error: 'GL_COMPILE_STATUS' was not declared in this scope
main.cpp:109:54: error: 'glGetShaderiv' was not declared in this scope
main.cpp:117:26: error: 'glLinkProgram' was not declared in this scope
main.cpp:118:28: error: 'GL_LINK_STATUS' was not declared in this scope
main.cpp:123:25: error: 'glUseProgram' was not declared in this scope

像这样的错误

首先,我要在源代码中添加正确的include指令。我不能告诉你更多,如果你没有发布一些实际的源代码

更新 在链接的源代码中有以下内容:

#include <GLUT/glut.h> 

在glutCreateWindow(…)之后添加一个调用
glewInit()
,我认为您应该后退几步,阅读。它有教程和关于如何构建它们的章节。

我已经链接了我从中获取的代码。@2vision2:查看我的更新
#include <GLUT/glut.h> 
#include <GL/glew.h>
#include <GL/glut.h>