Skip to main content



      Home
Home » Newcomers » Newcomers » opengl / glut in eclipse
opengl / glut in eclipse [message #232575] Fri, 14 September 2007 05:52 Go to next message
Eclipse UserFriend
Originally posted by: athalemica.yahoo.com.au

I've been trying to figure out how to get glut and openGl working in
eclipse to no success. I'm using eclipse 3.3 and this is the code i'm using
/* Demo.cpp
* A simple OpenGL program using GLUT. It creates a blank black
* window which can be used as a starting point for OpenGL programming.
*
* Link in opengl32, glu32, and glut32 libraries and make sure to include
* windows.h if you are compiling with Eclipse in Windows.
*
* Author: Paul Solt 3-4-07
* Based on examples from the Red book OpenGL Programming Guide
*/
#include <windows.h>
#include <GL/glut.h>

const int WIDTH = 600;
const int HEIGHT = 480;

/* Prototypes */
void init();
void display();

/* Definitions */

/* Initializes the OpenGL state */
void init() {
glClearColor( 0.0, 0.0, 0.0, 1.0 ); /* Set the clear color */
}

/* Displays a black clear screen */
void display() {
glClear( GL_COLOR_BUFFER_BIT ); /* Clear the screen with the clear color
*/
glutSwapBuffers(); /* Double buffering */
}

/* The main function */
int main( int argc, char *argv[] ) {
/* Glut setup function calls */
glutInit( &argc, argv );
glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB ); /* Use double buffering
and RGB colors */
glutInitWindowPosition( 100, 100 );
glutInitWindowSize( WIDTH, HEIGHT );
glutCreateWindow( argv[0] );
init();
glutDisplayFunc( display ); /* Call back display function */
glutMainLoop(); /* Continue drawing the scene */
return 0;
}
I am using MinGW for the compiling,

and these are my errors...

Severity and Description Path Resource Location Creation Time Id
src\glutDemo.o: In function `glutCreateMenu_ATEXIT_HACK':C:/Program
Files/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include /GL/glut.h
undefined reference to `__glutCreateMenuWithExit@8' glutDemo line
546 1189763239410 72
src\glutDemo.o: In function `glutCreateWindow_ATEXIT_HACK':C:/Program
Files/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include /GL/glut.h
undefined reference to `__glutCreateWindowWithExit@8' glutDemo line
500 1189763239410 71
src\glutDemo.o: In function `glutInit_ATEXIT_HACK':C:/Program
Files/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include /GL/glut.h
undefined reference to `__glutInitWithExit@12' glutDemo line
483 1189763239410 70
undefined reference to `glClear@4' glutDemo/src glutDemo.cpp line
30 1189763239410 74
undefined reference to `glClearColor@16' glutDemo/src glutDemo.cpp line
25 1189763239410 73
undefined reference to `glutDisplayFunc@4' glutDemo/src glutDemo.cpp line
43 1189763239410 79
undefined reference to
`glutInitDisplayMode@4' glutDemo/src glutDemo.cpp line 38 1189763239410 76
undefined reference to
`glutInitWindowPosition@8' glutDemo/src glutDemo.cpp line
39 1189763239410 77
undefined reference to
`glutInitWindowSize@8' glutDemo/src glutDemo.cpp line 40 1189763239410 78
undefined reference to `glutMainLoop@0' glutDemo/src glutDemo.cpp line
44 1189763239410 80
undefined reference to `glutSwapBuffers@0' glutDemo/src glutDemo.cpp line
31 1189763239410 75

does anyone know how to fix this up?
Re: opengl / glut in eclipse [message #232605 is a reply to message #232575] Fri, 14 September 2007 06:55 Go to previous message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Ryan,

This sounds like a question that might get better attention on the CDT
newsgroup: news://news.eclipse.org/eclipse.tools.cdt


Ryan wrote:
> I've been trying to figure out how to get glut and openGl working in
> eclipse to no success. I'm using eclipse 3.3 and this is the code i'm
> using
> /* Demo.cpp
> * A simple OpenGL program using GLUT. It creates a blank black
> * window which can be used as a starting point for OpenGL programming.
> * * Link in opengl32, glu32, and glut32 libraries and make sure to
> include
> * windows.h if you are compiling with Eclipse in Windows.
> * * Author: Paul Solt 3-4-07
> * Based on examples from the Red book OpenGL Programming Guide
> */
> #include <windows.h>
> #include <GL/glut.h>
>
> const int WIDTH = 600;
> const int HEIGHT = 480;
>
> /* Prototypes */
> void init();
> void display();
>
> /* Definitions */
>
> /* Initializes the OpenGL state */
> void init() {
> glClearColor( 0.0, 0.0, 0.0, 1.0 ); /* Set the clear color */
> }
>
> /* Displays a black clear screen */
> void display() {
> glClear( GL_COLOR_BUFFER_BIT ); /* Clear the screen with the clear
> color */
> glutSwapBuffers(); /* Double buffering */
> }
>
> /* The main function */
> int main( int argc, char *argv[] ) {
> /* Glut setup function calls */
> glutInit( &argc, argv );
> glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB ); /* Use double
> buffering and RGB colors */
> glutInitWindowPosition( 100, 100 );
> glutInitWindowSize( WIDTH, HEIGHT );
> glutCreateWindow( argv[0] );
> init();
> glutDisplayFunc( display ); /* Call back display function */
> glutMainLoop(); /* Continue drawing the scene */
> return 0;
> }
> I am using MinGW for the compiling,
> and these are my errors...
>
> Severity and Description Path Resource Location Creation
> Time Id
> src\glutDemo.o: In function `glutCreateMenu_ATEXIT_HACK':C:/Program
> Files/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include /GL/glut.h
> undefined reference to `__glutCreateMenuWithExit@8' glutDemo
> line 546 1189763239410 72
> src\glutDemo.o: In function `glutCreateWindow_ATEXIT_HACK':C:/Program
> Files/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include /GL/glut.h
> undefined reference to `__glutCreateWindowWithExit@8'
> glutDemo line 500 1189763239410 71
> src\glutDemo.o: In function `glutInit_ATEXIT_HACK':C:/Program
> Files/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include /GL/glut.h
> undefined reference to `__glutInitWithExit@12' glutDemo line
> 483 1189763239410 70
> undefined reference to `glClear@4' glutDemo/src glutDemo.cpp
> line 30 1189763239410 74
> undefined reference to `glClearColor@16' glutDemo/src
> glutDemo.cpp line 25 1189763239410 73
> undefined reference to `glutDisplayFunc@4' glutDemo/src
> glutDemo.cpp line 43 1189763239410 79
> undefined reference to `glutInitDisplayMode@4' glutDemo/src
> glutDemo.cpp line 38 1189763239410 76
> undefined reference to `glutInitWindowPosition@8' glutDemo/src
> glutDemo.cpp line 39 1189763239410 77
> undefined reference to `glutInitWindowSize@8' glutDemo/src
> glutDemo.cpp line 40 1189763239410 78
> undefined reference to `glutMainLoop@0' glutDemo/src
> glutDemo.cpp line 44 1189763239410 80
> undefined reference to `glutSwapBuffers@0' glutDemo/src
> glutDemo.cpp line 31 1189763239410 75
>
> does anyone know how to fix this up?
>
Previous Topic:Can I use my own debuggger (DDD)?
Next Topic:p
Goto Forum:
  


Current Time: Wed Jul 23 10:42:29 EDT 2025

Powered by FUDForum. Page generated in 0.06694 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top