PDA

View Full Version : Errors in program, Please help.



ayanda83
03-06-2014, 10:38 PM
hi everybody, here is my program below, its giving me errors as you can see in the compile log below. All the libraries have been linked and placed in the correct places (i.e. the INCLUDE AND LIB paths for MingW and the all the dll's are placed in the system folders, both system32 and WowSys64). what could be causing these errors then.

#include <GL/glew.h>
#include <GL/freeglut.h>

#define GLEW_STATIC
//#define FREEGLUT_STATIC
#define x 2.0
#define y 2.0
#define height 2.0
#define width 2.0

void render(void);

int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH|GLUT_DOUBLE|GLUT_RG B);
glutIntWindowPosition(0,0);
glutInitWindowSize(640,480);
glutCreateWindow("Assignment1");

glutDisplayFunction(render);

glutMainLoop();

}

void render(void)
{

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glBegin(GL_POLYGON)
glVertex2f(x, y);
glVertex2f(x, y+width);
glVertex2f(x+width, y+height);
glVertex2f(x+width, y);
glEnd()
}


errors are as follows:

mingw32-g++.exe -Wall -fexceptions -g -c "C:\UNISA MODULES\COS3712\assisgnment1\main.cpp" -o obj\Debug\main.o
C:\UNISA MODULES\COS3712\assisgnment1\main.cpp: In function 'int main(int, char**)':
C:\UNISA MODULES\COS3712\assisgnment1\main.cpp:18:30: error: 'glutIntWindowPosition' was not declared in this scope
C:\UNISA MODULES\COS3712\assisgnment1\main.cpp:22:31: error: 'glutDisplayFunction' was not declared in this scope
Process terminated with status 1 (0 minutes, 1 seconds)
2 errors, 0 warnings (0 minutes, 1 seconds)

tonyo_au
03-07-2014, 12:27 AM
glutIntWindowPosition should be glutInitPositionWindow

glutDisplayFunction should be glutDisplayFunc

Always be careful of the source of code you copy. Since you are using freeglut check your calls again the freeglut doc (http://freeglut.sourceforge.net/docs/api.php)