www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Can't find GLU symbols when compiling SimpleGL.d found in GtkD/demos

reply "Enjoys Math" <enjoysmath gmail.com> writes:
The code is:

/*
  * This file is part of gtkD.
  *
  * dui is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as 
published by
  * the Free Software Foundation; either version 3 of the License, 
or
  * (at your option) any later version.
  *
  * dui is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General 
Public License
  * along with dui; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 
02110, USA
  */

module simpleGL.SimpleGL;

private import gdk.Event;
private import gtk.DrawingArea;
private import gtk.Main;
private import gtk.MainWindow;
private import gtk.Widget;
private import glgdk.GLConfig;
private import glgdk.GLContext;
private import glgdk.GLdInit;
private import glgdk.GLWindow;
private import glgtk.GLCapability;
private import gtkglc.glgdktypes;

private import gtkglc.gl;
private import gtkglc.glu;

/**
  * This is a Simple class extending the DrawingArea widget.
  * A really simple Demo illustrating OpenGL with GtkD
  * It uses the GLCapability mixin to add the GL capabilities to 
the widget.
  * This example is provided under the terms of the GPL License.
  * Note the initialization of the GLCapabilities on the 
constructor.
  *
  *  author pac tuxfamily.org
  */
class SimpleGL : DrawingArea
{

	GLfloat width;
	GLfloat height;
	
	/** need to include the mixin to add GL capabilities to this 
widget */
	mixin GLCapability;

	/**
	 * Construct a simple DrawingArea and sets the GLCapabilities
	 */
	this()
	{
		super(300, 300);
		setGLCapability();	// set the GL capabilities for this widget
	}

	/**
	 * put any gl initializations here
	 * returns true to consume the event
	 */
	void initGL()
	{
		resizeGL(null);
	}
	
	/**
	 * This method is called every time the window must be paint or 
repaint
	 * This is where you put the OpenGL call to draw something.
	 * This method call be called directly by the application 
without an event object
	 * to force redrawing of the scene.
	 * returns true to consume the event
	 */
	bool drawGL()
	{
		glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
		glLoadIdentity ();

		gluLookAt(0, 0, 10, 0, 0, 0, 0, 1,0); //Set the camera position

		//Just Draw a tri-colored triangle
		glBegin(GL_TRIANGLES);
		glColor3f(1.0f,0.0f,0.0f);
		glVertex3f( 0.0f, 1.0f, 0.0f);
		glColor3f(0.0f,1.0f,0.0f);
		glVertex3f(-1.0f,-1.0f, 0.0f);
		glColor3f(0.0f,0.0f,1.0f);
		glVertex3f( 1.0f,-1.0f, 0.0f);
		glEnd();
			
		return true;
	}

	/**
	 * This method is called when the window is resized
	 * returns true to consume the event
	 */
	bool resizeGL(Event event = null)
	{
		GLfloat w;
		GLfloat h;
		
		if ( event is null || event.type != GdkEventType.CONFIGURE )
		{
			w = getWidth();
			h = getHeight();
		}
		else
		{
			w = event.configure.width;
			h = event.configure.height;
		}
		
		width = w;
		height = h;
		
		glViewport (0, 0, cast(int)w, cast(int)h); //Adjust the 
viewport according to new window dimensions

		/*
		 * Update the projection Matrix accoding to the new dimension
		 * and reset the OpenGL state to MODELVIEW
		 */
		glMatrixMode (GL_PROJECTION);
		glLoadIdentity ();
		gluPerspective(20, w/h, 0.1, 10);
		glMatrixMode (GL_MODELVIEW);

		return true;
	}
}

void main(string[] args)
{
	Main.init(args);

	GLdInit.init(args);
	
	SimpleGL simpleGL = new SimpleGL();
	MainWindow window = new MainWindow("Simplest OpenGL Example");
	window.add(simpleGL);
	window.showAll();
		
	Main.run();
}


The errors are:

Building Debug\SimpleGL.exe...
OPTLINK (R) for Win32  Release 8.00.12
Copyright (C) Digital Mars 1989-2010  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
Debug\SimpleGL.obj(SimpleGL)
  Error 42: Symbol Undefined _gluLookAt 72
Debug\SimpleGL.obj(SimpleGL)
  Error 42: Symbol Undefined _gluPerspective 32
Debug\SimpleGL.obj(SimpleGL)
  Error 42: Symbol Undefined _D6gtkglc3glu12__ModuleInfoZ
Debug\SimpleGL.obj(SimpleGL)
  Error 42: Symbol Undefined _D6gtkglc2gl12__ModuleInfoZ

I'm linking with GlU32.Lib and OpenGL32.Lib found in a "windows 
sdk" folder on my system with a windows search.  I converted them 
to OMF using the coffimplib tool provided by digital mars.  So 
this worked for the OpenGL32.Lib and got rid of those errors but 
the GlU32.Lib symbol errors persist.

Thank you!
May 18 2013
next sibling parent "Enjoys Math" <enjoysmath gmail.com> writes:
Don't know if this helps but I did a dumpbin on the original COFF 
glu32.lib and output is:

    Exports

        ordinal    name

                   _gluUnProject 48
                   _gluTessVertex 12
                   _gluTessProperty 16
                   _gluTessNormal 28
                   _gluTessEndPolygon 4
                   _gluTessEndContour 4
                   _gluTessCallback 12
                   _gluTessBeginPolygon 8
                   _gluTessBeginContour 4
                   _gluSphere 20
                   _gluScaleImage 36
                   _gluQuadricTexture 8
                   _gluQuadricOrientation 8
                   _gluQuadricNormals 8
                   _gluQuadricDrawStyle 8
                   _gluQuadricCallback 12
                   _gluPwlCurve 20
                   _gluProject 48
                   _gluPickMatrix 36
                   _gluPerspective 32
                   _gluPartialDisk 44
                   _gluOrtho2D 32
                   _gluNurbsSurface 44
                   _gluNurbsProperty 12
                   _gluNurbsCurve 28
                   _gluNurbsCallback 12
                   _gluNextContour 8
                   _gluNewTess 0
                   _gluNewQuadric 0
                   _gluNewNurbsRenderer 0
                   _gluLookAt 72
                   _gluLoadSamplingMatrices 16
                   _gluGetTessProperty 12
                   _gluGetString 4
                   _gluGetNurbsProperty 12
                   _gluErrorUnicodeStringEXT 4
                   _gluErrorString 4
                   _gluEndTrim 4
                   _gluEndSurface 4
                   _gluEndPolygon 4
                   _gluEndCurve 4
                   _gluDisk 28
                   _gluDeleteTess 4
                   _gluDeleteQuadric 4
                   _gluDeleteNurbsRenderer 4
                   _gluCylinder 36
                   _gluBuild2DMipmaps 28
                   _gluBuild1DMipmaps 24
                   _gluBeginTrim 4
                   _gluBeginSurface 4
                   _gluBeginPolygon 4
                   _gluBeginCurve 4
May 18 2013
prev sibling parent reply Alexandr Druzhinin <drug2004 bk.ru> writes:
Try this http://gtkd.org/Downloads/GtkDGL.zip
May 19 2013
parent reply Mike Wey <mike-wey example.com> writes:
On 05/19/2013 09:43 AM, Alexandr Druzhinin wrote:
 Try this http://gtkd.org/Downloads/GtkDGL.zip
The glu32.lib in that zip contains only the symbols needed by the SimpleGL demo. -- Mike Wey
May 19 2013
next sibling parent reply "Enjoys Math" <enjoysmath gmail.com> writes:
All right, the glu errors are gone but I still have

OPTLINK (R) for Win32  Release 8.00.12
Copyright (C) Digital Mars 1989-2010  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
Debug\ConsoleApp2.obj(ConsoleApp2)
  Error 42: Symbol Undefined _D6gtkglc2gl12__ModuleInfoZ
Debug\ConsoleApp2.obj(ConsoleApp2)
  Error 42: Symbol Undefined _D6gtkglc3glu12__ModuleInfoZ
Building Debug\ConsoleApp2.exe failed!

I replaced all my .libs with those in the zip.
May 19 2013
parent Mike Wey <mike-wey example.com> writes:
On 05/19/2013 05:06 PM, Enjoys Math wrote:
 All right, the glu errors are gone but I still have

 OPTLINK (R) for Win32  Release 8.00.12
 Copyright (C) Digital Mars 1989-2010  All rights reserved.
 http://www.digitalmars.com/ctg/optlink.html
 Debug\ConsoleApp2.obj(ConsoleApp2)
   Error 42: Symbol Undefined _D6gtkglc2gl12__ModuleInfoZ
 Debug\ConsoleApp2.obj(ConsoleApp2)
   Error 42: Symbol Undefined _D6gtkglc3glu12__ModuleInfoZ
 Building Debug\ConsoleApp2.exe failed!

 I replaced all my .libs with those in the zip.
Building with bud/build doesn't include the opengl and glu files in the GtkD.lib, Fixed in: https://github.com/gtkd-developers/GtkD/commit/c19a533e018bab16ba6ad44afe8a46540a7e5a6a -- Mike Wey
May 19 2013
prev sibling parent reply Alexandr Druzhinin <drug2004 bk.ru> writes:
19.05.2013 20:11, Mike Wey пишет:
 On 05/19/2013 09:43 AM, Alexandr Druzhinin wrote:
 Try this http://gtkd.org/Downloads/GtkDGL.zip
The glu32.lib in that zip contains only the symbols needed by the SimpleGL demo.
I built more complex application than SimpleGL successfully with it. Can you provide more info about its restriction?
May 19 2013
parent reply Mike Wey <mike-wey example.com> writes:
On 05/19/2013 06:10 PM, Alexandr Druzhinin wrote:
 19.05.2013 20:11, Mike Wey пишет:
 On 05/19/2013 09:43 AM, Alexandr Druzhinin wrote:
 Try this http://gtkd.org/Downloads/GtkDGL.zip
The glu32.lib in that zip contains only the symbols needed by the SimpleGL demo.
I built more complex application than SimpleGL successfully with it. Can you provide more info about its restriction?
I created it using a def file containing the symbols the SimpleGL demo needed. -- Mike Wey
May 19 2013
parent reply "Enjoys Math" <enjoysmath gmail.com> writes:
I've built GtkD from the latest on github and linked with 
gtkd.lib gtkdgl.lib and still have the undefined symbols:

OPTLINK (R) for Win32  Release 8.00.12
Copyright (C) Digital Mars 1989-2010  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
Debug\ConsoleApp2.obj(ConsoleApp2)
  Error 42: Symbol Undefined _glFlush 0
Debug\ConsoleApp2.obj(ConsoleApp2)
  Error 42: Symbol Undefined _gluLookAt 72
Debug\ConsoleApp2.obj(ConsoleApp2)
  Error 42: Symbol Undefined _glBegin 4
Debug\ConsoleApp2.obj(ConsoleApp2)
  Error 42: Symbol Undefined _glClear 4
Debug\ConsoleApp2.obj(ConsoleApp2)
  Error 42: Symbol Undefined _glColor3f 12
Debug\ConsoleApp2.obj(ConsoleApp2)
  Error 42: Symbol Undefined _glVertex3f 12
Debug\ConsoleApp2.obj(ConsoleApp2)
  Error 42: Symbol Undefined _glEnd 0
Debug\ConsoleApp2.obj(ConsoleApp2)
  Error 42: Symbol Undefined _glLoadIdentity 0
Debug\ConsoleApp2.obj(ConsoleApp2)
  Error 42: Symbol Undefined _glMatrixMode 4
Debug\ConsoleApp2.obj(ConsoleApp2)
  Error 42: Symbol Undefined _glViewport 16
Debug\ConsoleApp2.obj(ConsoleApp2)
  Error 42: Symbol Undefined _gluPerspective 32
May 19 2013
parent reply Mike Wey <mike-wey example.com> writes:
On 05/19/2013 07:08 PM, Enjoys Math wrote:
 I've built GtkD from the latest on github and linked with gtkd.lib
 gtkdgl.lib and still have the undefined symbols:

 OPTLINK (R) for Win32  Release 8.00.12
 Copyright (C) Digital Mars 1989-2010  All rights reserved.
 http://www.digitalmars.com/ctg/optlink.html
 Debug\ConsoleApp2.obj(ConsoleApp2)
   Error 42: Symbol Undefined _glFlush 0
 Debug\ConsoleApp2.obj(ConsoleApp2)
   Error 42: Symbol Undefined _gluLookAt 72
 Debug\ConsoleApp2.obj(ConsoleApp2)
   Error 42: Symbol Undefined _glBegin 4
 Debug\ConsoleApp2.obj(ConsoleApp2)
   Error 42: Symbol Undefined _glClear 4
 Debug\ConsoleApp2.obj(ConsoleApp2)
   Error 42: Symbol Undefined _glColor3f 12
 Debug\ConsoleApp2.obj(ConsoleApp2)
   Error 42: Symbol Undefined _glVertex3f 12
 Debug\ConsoleApp2.obj(ConsoleApp2)
   Error 42: Symbol Undefined _glEnd 0
 Debug\ConsoleApp2.obj(ConsoleApp2)
   Error 42: Symbol Undefined _glLoadIdentity 0
 Debug\ConsoleApp2.obj(ConsoleApp2)
   Error 42: Symbol Undefined _glMatrixMode 4
 Debug\ConsoleApp2.obj(ConsoleApp2)
   Error 42: Symbol Undefined _glViewport 16
 Debug\ConsoleApp2.obj(ConsoleApp2)
   Error 42: Symbol Undefined _gluPerspective 32
Are you linking with opengl and glu ? -- Mike Wey
May 19 2013
next sibling parent "Enjoys Math" <enjoysmath gmail.com> writes:
On Sunday, 19 May 2013 at 17:16:01 UTC, Mike Wey wrote:
 On 05/19/2013 07:08 PM, Enjoys Math wrote:
 I've built GtkD from the latest on github and linked with 
 gtkd.lib
 gtkdgl.lib and still have the undefined symbols:

 OPTLINK (R) for Win32  Release 8.00.12
 Copyright (C) Digital Mars 1989-2010  All rights reserved.
 http://www.digitalmars.com/ctg/optlink.html
 Debug\ConsoleApp2.obj(ConsoleApp2)
  Error 42: Symbol Undefined _glFlush 0
 Debug\ConsoleApp2.obj(ConsoleApp2)
  Error 42: Symbol Undefined _gluLookAt 72
 Debug\ConsoleApp2.obj(ConsoleApp2)
  Error 42: Symbol Undefined _glBegin 4
 Debug\ConsoleApp2.obj(ConsoleApp2)
  Error 42: Symbol Undefined _glClear 4
 Debug\ConsoleApp2.obj(ConsoleApp2)
  Error 42: Symbol Undefined _glColor3f 12
 Debug\ConsoleApp2.obj(ConsoleApp2)
  Error 42: Symbol Undefined _glVertex3f 12
 Debug\ConsoleApp2.obj(ConsoleApp2)
  Error 42: Symbol Undefined _glEnd 0
 Debug\ConsoleApp2.obj(ConsoleApp2)
  Error 42: Symbol Undefined _glLoadIdentity 0
 Debug\ConsoleApp2.obj(ConsoleApp2)
  Error 42: Symbol Undefined _glMatrixMode 4
 Debug\ConsoleApp2.obj(ConsoleApp2)
  Error 42: Symbol Undefined _glViewport 16
 Debug\ConsoleApp2.obj(ConsoleApp2)
  Error 42: Symbol Undefined _gluPerspective 32
Are you linking with opengl and glu ?
You mean in addition to GtkD.lib GtkDGL.lib I should also link wigh glu32.lib & opengl32.lib?
May 19 2013
prev sibling parent "Enjoys Math" <enjoysmath gmail.com> writes:
On Sunday, 19 May 2013 at 17:16:01 UTC, Mike Wey wrote:
 Are you linking with opengl and glu ?
That fixed it! Thanks! ^_^
May 19 2013