c++ - Type 'GLchar' could not be resolved -


i'm using eclipse, mingw, , have compiled freeglut , glew , copied libraries, dlls, , header files proper locations (mingw/include/gl, mingw/lib, windows/syswow64). have linked libraries (freeglut64, opengl32, glew32, glu32) in eclipse under mingw c++ linker. here code...

--chargame.cpp-- #include <stdlib.h> #include <stdio.h> #include <string.h> #include <gl/glew.h> #include <gl/freeglut.h> #include "chargame.h" #define window_title "chargame"  int currentwidth = 800,     currentheight = 600,     windowhandle = 0; unsigned framecount = 0; gluint vertexshaderid,     fragmentshaderid,     programid,     vaoid,     vboid,     colorbufferid;  int main(int argc, char* argv[]) {     initialize(argc, argv);     glutmainloop();     exit(exit_success); } const glchar* vertexshader = {     "#version 400\n"\      "layout(location=0) in vec4 in_position;\n"\     "layout(location=1) in vec4 in_color;\n"\     "out vec4 ex_color;\n"\      "void main(void)\n"\     "{\n"\     "   gl_position = in_position;\n"\     "   ex_color = in_color;\n"\     "}\n" }; const glchar* fragmentshader = {     "#version 400\n"\      "in vec4 ex_color;\n"\     "out vec4 out_color;\n"\      "void main(void)\n"\     "{\n"\     "   out_color = ex_color;\n"\     "}\n" };  void initialize(int argc, char* argv[]) {     glutinit(&argc, argv);     glutinitcontextversion(4, 0);     glutinitcontextflags(glut_forward_compatible);     glutinitcontextprofile(glut_core_profile);     glutsetoption(glut_action_on_window_close, glut_action_glutmainloop_returns);     glutinitwindowsize(currentwidth, currentheight);     glutinitdisplaymode(glut_depth | glut_double | glut_rgba);     windowhandle = glutcreatewindow(window_title);     if (windowhandle < 1) {         fprintf(stderr, "error: not create render window.\n");         exit(exit_failure);     }     glutreshapefunc(resize);     glutdisplayfunc(render);     glutidlefunc(idle);     gluttimerfunc(0, timer, 0);      fprintf(stdout, "info: opengl version: %s\n", glgetstring(gl_version));     glclearcolor(0.0f, 0.0f, 0.0f, 0.0f);  }  void resize(int width, int height) {     currentheight = height;     currentwidth = width;     glviewport(0, 0, currentwidth, currentheight); }  void render(void) {     ++framecount;     glclear(gl_color_buffer_bit | gl_depth_buffer_bit);     gldrawarrays(gl_triangles, 0, 3);      glutswapbuffers();     glutpostredisplay(); }  void idle(void) {     glutpostredisplay(); }  void timer(int value) {     if (0 != value) {         char* tempstring = (char*) malloc(512 + strlen(window_title));         sprintf(tempstring, "%s: %d frames per second @ %d x %d", window_title, framecount*4, currentwidth, currentheight);         glutsetwindowtitle(tempstring);         free(tempstring);     }     framecount = 0;     gluttimerfunc(250, timer, 1); } --end chargame.cpp--  --chargame.h-- #ifndef chargame_h_ #define chargame_h_  void initialize(int, char*[]); void initwindow(int, char*[]); void resize(int,int); void render(void); void timer(int); void idle(void);  #endif --end chargame.h-- 

i believe have done right, however, eclipse throws error "type 'glchar' not resolved" on vertexshader , fragmentshader. did make mistake in code or miss required step?

you're not declaring string constants right way. don't need curly braces there. , watch out empty lines betwreen strings - either remove them (see below) or add "\" there.

include "gl/gl.h" file before "glew.h", might also.

use ordinary chars:

const char* vertexshader = "#version 400\n"\ "layout(location=0) in vec4 in_position;\n"\ "layout(location=1) in vec4 in_color;\n"\ "out vec4 ex_color;\n"\ "void main(void)\n"\ "{\n"\ "   gl_position = in_position;\n"\ "   ex_color = in_color;\n"\ "}\n";  const char* fragmentshader = "#version 400\n"\ "in vec4 ex_color;\n"\ "out vec4 out_color;\n"\ "void main(void)\n"\ "{\n"\ "   out_color = ex_color;\n"\ "}\n"; 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -