PDA

View Full Version : [Windows + MingW32] Need for code improvement, compiling options



Suddhasheel
06-09-2005, 01:14 AM
I am compiling the following program.... using MingW32 and Dev-C++

#include <windows.h>
#include <GL\glut.h>
#include <GL\glu.h>
#include <GL\glaux.h>


void init()//easy name to remember
{
glClearColor(1,0,0,1);
glOrtho(0,1,0,1,0,1);
}

void display()
{
glClear(GL_COLOR_BUFFER_BIT);
glFlush();
}

int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB|GLUT_SINGLE);
glutInitWindowSize(800,600);
glutInitWindowPosition(5,20);
glutCreateWindow("Tutorial 1");
init();
glutDisplayFunc(display);
glutMainLoop();
return 0;
}

I compiled in the following manner ... but there are certain error messages now... Please help....

Compiler: Default compiler
Executing g++.exe...
g++.exe "D:\shudh\ccodes\ogl_vertex_data\ogl_vertex_data\te st.cpp" -o "D:\shudh\ccodes\ogl_vertex_data\ogl_vertex_data\te st.exe" -I"C:\apps\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\apps\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\apps\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\apps\Dev-Cpp\include\c++\3.4.2" -I"C:\apps\Dev-Cpp\include" -L"C:\apps\Dev-Cpp\lib" -lglu32 -lopengl32 -lglut -lglaux -lglut32 -mwindows
C:\apps\Dev-Cpp\lib/libglut32.a(glut_event.o)(.text+0x319):glut_event. c: undefined reference to `glFinish@0'
C:\apps\Dev-Cpp\lib/libglut32.a(glut_event.o)(.text+0x374):glut_event. c: undefined reference to `wglSwapBuffers@4'
C:\apps\Dev-Cpp\lib/libglut32.a(glut_event.o)(.text+0x3dc):glut_event. c: undefined reference to `wglSwapBuffers@4'
C:\apps\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x18f):glut_win.c: undefined reference to `wglGetCurrentContext@0'
C:\apps\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x196):glut_win.c: undefined reference to `wglGetCurrentDC@0'
C:\apps\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x1b6):glut_win.c: undefined reference to `wglMakeCurrent@8'
C:\apps\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x1d5):glut_win.c: undefined reference to `glViewport@16'
C:\apps\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x1f7):glut_win.c: undefined reference to `wglMakeCurrent@8'
C:\apps\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x216):glut_win.c: undefined reference to `glViewport@16'
C:\apps\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x21e):glut_win.c: undefined reference to `wglGetCurrentContext@0'
C:\apps\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x225):glut_win.c: undefined reference to `wglGetCurrentDC@0'
C:\apps\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x241):glut_win.c: undefined reference to `wglMakeCurrent@8'
C:\apps\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x843):glut_win.c: undefined reference to `wglGetCurrentContext@0'
C:\apps\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x84a):glut_win.c: undefined reference to `wglGetCurrentDC@0'
C:\apps\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x866):glut_win.c: undefined reference to `wglMakeCurrent@8'
C:\apps\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x897):glut_win.c: undefined reference to `glDrawBuffer@4'
C:\apps\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x8a6):glut_win.c: undefined reference to `glReadBuffer@4'
C:\apps\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0xaa1):glut_win.c: undefined reference to `wglDeleteContext@4'
C:\apps\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0xb61):glut_win.c: undefined reference to `wglMakeCurrent@8'
C:\apps\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0xbd2):glut_win.c: undefined reference to `wglGetCurrentContext@0'
C:\apps\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0xbd9):glut_win.c: undefined reference to `wglGetCurrentDC@0'
C:\apps\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0xbf5):glut_win.c: undefined reference to `wglMakeCurrent@8'
C:\apps\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0xcb4):glut_win.c: undefined reference to `wglGetCurrentContext@0'
C:\apps\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0xcbb):glut_win.c: undefined reference to `wglGetCurrentDC@0'
C:\apps\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0xcd7):glut_win.c: undefined reference to `wglMakeCurrent@8'
C:\apps\Dev-Cpp\lib/libglut32.a(glut_mesa.o)(.text+0x80):glut_mesa.c: undefined reference to `glGetString@4'
C:\apps\Dev-Cpp\lib/libglut32.a(glut_mesa.o)(.text+0x91):glut_mesa.c: undefined reference to `glGetString@4'
C:\apps\Dev-Cpp\lib/libglut32.a(glut_util.o)(.text+0x281):glut_util.c: undefined reference to `glGetError@0'
C:\apps\Dev-Cpp\lib/libglut32.a(glut_util.o)(.text+0x28d):glut_util.c: undefined reference to `gluErrorString@4'
C:\apps\Dev-Cpp\lib/libglut32.a(win32_glx.o)(.text+0x30d):win32_glx.c: undefined reference to `wglCreateContext@4'
C:\apps\Dev-Cpp\lib/libglut32.a(glut_swap.o)(.text+0x71):glut_swap.c: undefined reference to `wglSwapBuffers@4'
C:\apps\Dev-Cpp\lib/libglut32.a(win32_winproc.o)(.text+0x292):win32_wi nproc.c: undefined reference to `joyReleaseCapture@4'
C:\apps\Dev-Cpp\lib/libglut32.a(win32_winproc.o)(.text+0x3fc):win32_wi nproc.c: undefined reference to `joySetCapture@16'
C:\apps\Dev-Cpp\lib/libglut32.a(win32_winproc.o)(.text+0x162f):win32_w inproc.c: undefined reference to `joyGetPosEx@8'
C:\apps\Dev-Cpp\lib/libglut32.a(win32_winproc.o)(.text+0x171f):win32_w inproc.c: undefined reference to `joyGetPosEx@8'
collect2: ld returned 1 exit status

Execution terminated

Overmind
06-09-2005, 03:28 AM
Just a wild guess, but try using either -lglut or -lglut32, not both of them...

Suddhasheel
06-09-2005, 04:50 AM
Nopes doesnt work.... !!!!! :( :( :(

06-11-2005, 01:19 AM
Go to this page.
http://www.cs.uofs.edu/~mpc3/cmps370/glutsetup.html
Compiler switches are required and glut.h is different for Dev C++.

Follow insructions (do not skip any on the page). U shall be up and running.

Suddhasheel
06-12-2005, 11:50 PM
Compiler: Default compiler
Building Makefile: "D:\shudh\ccodes\Makefile.win"
Executing make...
make.exe -f "D:\shudh\ccodes\Makefile.win" all
gcc.exe main.o -o "gluttest.exe" -L"C:/apps/Dev-Cpp/lib" -lglu32 -lopengl32 -lglaux -lglut32 -mwindows C:/apps/Dev-Cpp/lib/libglut32.a C:/apps/Dev-Cpp/lib/libglu32.a C:/apps/Dev-Cpp/lib/libopengl32.a

C:/apps/Dev-Cpp/lib/libglut32.a(win32_winproc.o)(.text+0x292):win32_wi nproc.c: undefined reference to `joyReleaseCapture@4'
C:/apps/Dev-Cpp/lib/libglut32.a(win32_winproc.o)(.text+0x3fc):win32_wi nproc.c: undefined reference to `joySetCapture@16'
C:/apps/Dev-Cpp/lib/libglut32.a(win32_winproc.o)(.text+0x162f):win32_w inproc.c: undefined reference to `joyGetPosEx@8'
C:/apps/Dev-Cpp/lib/libglut32.a(win32_winproc.o)(.text+0x171f):win32_w inproc.c: undefined reference to `joyGetPosEx@8'
collect2: ld returned 1 exit status

make.exe: *** [gluttest.exe] Error 1

Execution terminated