delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/08/22/15:32:23

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-help AT sourceware DOT cygnus DOT com>,
<http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-Id: <3.0.6.32.19990822152158.007a4b70@pop.hotpop.com>
X-Sender: benvg AT pop DOT hotpop DOT com
X-Mailer: QUALCOMM Windows Eudora Light Version 3.0.6 (32)
Date: Sun, 22 Aug 1999 15:21:58 -0400
To: <cygwin AT sourceware DOT cygnus DOT com>
From: Ben <benvg AT hotpop DOT com>
Subject: Problems compiling with glut
Mime-Version: 1.0
X-HotPOP: -----------------------------------------------
Sent By HotPOP.com FREE Email
Get your FREE POP email at www.HotPOP.com
-----------------------------------------------

I have been compiling programs that use opengl for some time, and I decided
to try out glut, but I am having a hard time getting even the simple sample
programs that came with glut to compile. I built the .def files into .a
libraries with dlltool just like the directions say, but when I try to
compile, they linker gives me lots of messages like :
(the command line is "gcc -o simple.exe simple.c -lglut32 -lopengl32")

undefined reference to _imp__glEnd

It creates a message like that for every gl* function the program uses, but
I'm wondering where the "_imp__" came from? The weird thing is that none of
the glut functions cause these errors, only the opengl ones. But when I
compile a program that uses only opengl, none of these messages occur.

The same thing also occurs with -lglut and -lopengl.

Here is the program in case it helps:
---begin simple.c---
/* Copyright (c) Mark J. Kilgard, 1996. */

/* This program is freely
distributable without licensing fees 
   and is provided without guarantee
or warrantee expressed or 
   implied. This program is -not- in the public
domain. */

/* This program is a response to a question posed by Gil
Colgate
   <gcolgate AT sirius DOT com> about how lengthy a program is required
using
   OpenGL compared to using  Direct3D immediate mode to "draw a

triangle at screen coordinates 0,0, to 200,200 to 20,200, and I
   want it
to be blue at the top vertex, red at the left vertex, and
   green at the
right vertex".  I'm not sure how long the Direct3D
   program is; Gil has
used Direct3D and his guess is "about 3000
   lines of code". */

/* X
compile line: cc -o simple simple.c -lglut -lGLU -lGL -lXmu -lXext -lX11
-lm */

#include <GL/glut.h>

void
reshape(int w, int h)
{
  /* Because Gil
specified "screen coordinates" (presumably with an
     upper-left origin),
this short bit of code sets up the coordinate
     system to correspond to
actual window coodrinates.  This code
     wouldn't be required if you
chose a (more typical in 3D) abstract
     coordinate system. */


glViewport(0, 0, w, h);       /* Establish viewing area to cover entire
window. */
  glMatrixMode(GL_PROJECTION);  /* Start modifying the
projection matrix. */
  glLoadIdentity();             /* Reset project
matrix. */
  glOrtho(0, w, 0, h, -1, 1);   /* Map abstract coords directly
to window coords. */
  glScalef(1, -1, 1);           /* Invert Y axis so
increasing Y goes down. */
  glTranslatef(0, -h, 0);       /* Shift origin
up to upper-left corner. */
}

void
display(void)
{

glClear(GL_COLOR_BUFFER_BIT);
  glBegin(GL_TRIANGLES);
    glColor3f(0.0,
0.0, 1.0);  /* blue */
    glVertex2i(0, 0);
    glColor3f(0.0, 1.0, 0.0);
/* green */
    glVertex2i(200, 200);
    glColor3f(1.0, 0.0, 0.0);  /* red
*/
    glVertex2i(20, 200);
  glEnd();
  glFlush();  /* Single buffered, so
needs a flush. */
}

int
main(int argc, char **argv)
{
  glutInit(&argc,
argv);
  glutCreateWindow("single triangle");
  glutDisplayFunc(display);

glutReshapeFunc(reshape);
  glutMainLoop();
  return 0;             /* ANSI
C requires main to return int. */
}
---end simple.c---


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019