Using GLUT with a free compiler under Windows

Using GLUT with a free compiler under Windows

Post by Tsyra » Tue, 20 Aug 2002 08:41:37



Has anyone tips with using GLUT with a free compiler under Windows please?

I'm trying to compile using Dev-C++ (Cygwin compiler...) but get the
following linking errors :

"
d:\myopengl\testbis\main.o(.text+0x169):main.c: undefined reference to
`_imp__glutInit'
d:\myopengl\testbis\main.o(.text+0x179):main.c: undefined reference to
`_imp__glutInitDisplayMode'
d:\myopengl\testbis\main.o(.text+0x191):main.c: undefined reference to
`_imp__glutInitWindowSize'
d:\myopengl\testbis\main.o(.text+0x1a3):main.c: undefined reference to
`_imp__glutInitWindowPosition'
d:\myopengl\testbis\main.o(.text+0x1b6):main.c: undefined reference to
`_imp__glutCreateWindow'
d:\myopengl\testbis\main.o(.text+0x1ce):main.c: undefined reference to
`_imp__glutDisplayFunc'
d:\myopengl\testbis\main.o(.text+0x1d9):main.c: undefined reference to
`_imp__glutMainLoop'
"

I've also tried compiling with LCC from within the IDE that comes with it
but also get glut errors there.

[rant]I thought C was platform independent and so were OpenGL and GLUT but
here I realize just what a mess there is in-between with the
compilers[/rant].

I'm OK with C, I get a book to learn using OpenGL and GLUT... but I'm
completely lost with compilers :( So if anyone has a guide to that by the
way he'll be welcome since I don't really get all the magic going on behind
linking, librairies... and such.

Thanks a lot guys as I can't wait using OpenGL.

Kind regards -

Tsyrak

 
 
 

Using GLUT with a free compiler under Windows

Post by Wolfgang Draxinge » Tue, 20 Aug 2002 09:29:53


Quote:> [rant]I thought C was platform independent and so were OpenGL and GLUT but
> here I realize just what a mess there is in-between with the
> compilers[/rant].

C as a programming language isn't platform dependent at all.
OpenGL and GLUT are APIs, and yes, they're designed to be plattform
independent. However there are big differences among the file formats
used by the compilers out there. Most .lib files for windows out there
come in a M$ compiler format. BCC uses it's own one. I don't know if
Cygwin has it's own, or if it's compatible to BCC format. However I
suggest you to download GLUT sources and compile the stuff yourself.
Since no OpenGL function, but only GLUT finctions are mentiond by the
linker this should solve your problem.

Quote:> I'm OK with C, I get a book to learn using OpenGL and GLUT...

Then you should know, that GLUT isn't a integral part of OpenGL, but ia
framework, designed to allow quick (and mostly dirty) development of
small OpenGL proggies.

Quote:> Thanks a lot guys as I can't wait using OpenGL.

A well known feeling ;-)

--
+------------------------------------------------+
| +----------------+ WOLFGANG DRAXINGER          |
| | ,-.   DARKSTAR | lead programmer             |

| | `-' / GAMES /                                |
| +----+''''''''     http://www.darkstargames.de |
+------------------------------------------------+

 
 
 

Using GLUT with a free compiler under Windows

Post by Charles E Hardwidg » Tue, 20 Aug 2002 10:07:53


Quote:>C as a programming language isn't platform dependent at all.

It isn't platform independent, and different implementations within a single
platform contribute to the mess, as has already been commented on. I long
for the day when C and C++ finally turn up their toes and die.

--
Charles E Hardwidge
http://www.hardwidge.org.uk

 
 
 

Using GLUT with a free compiler under Windows

Post by Dave Eberl » Tue, 20 Aug 2002 12:06:48




Quote:> >C as a programming language isn't platform dependent at all.

> It isn't platform independent, and different implementations within a
single
> platform contribute to the mess, as has already been commented on. I long
> for the day when C and C++ finally turn up their toes and die.

I long for the day when folks finally learn how to use their software
development environments.  This includes understanding that when
you use someone else's library, you have to *add* that library to the
link list.  This includes understanding what the difference is between
a static-link library and a dynamic-link library.  For portable softare,
this includes knowing how various platforms treat these concepts
differently.

Learning this has nothing to do with C/C++.

--
Dave Eberly

http://www.magic-software.com
http://www.wild-magic.com

 
 
 

Using GLUT with a free compiler under Windows

Post by Thant Tessma » Wed, 21 Aug 2002 03:10:55





>>[...]I long
>>for the day when C and C++ finally turn up their toes and die.

> I long for the day when folks finally learn how to use their software
> development environments. [...]

[...]

Quote:

> Learning this has nothing to do with C/C++.

It does in the sense that C in particular has had a huge (and IMHO
negative) influence on the way we develop programs. Of course OpenGL is
a C library, so we just have to live with all that that implies...

-thant

 
 
 

Using GLUT with a free compiler under Windows

Post by Wolfgang Draxinge » Wed, 21 Aug 2002 05:53:06


1:
OpenGL isn't a C library at all. It's a API with bindings to almost
every major language.

2:
C/C++ in it's pure definition _are designed_ to be plattform
independent. There are no platform specific keywords or standard library
functions. All the plattform specific stuff is made using plattform
specific libraries.

--
+------------------------------------------------+
| +----------------+ WOLFGANG DRAXINGER          |
| | ,-.   DARKSTAR | lead programmer             |

| | `-' / GAMES /                                |
| +----+''''''''     http://www.darkstargames.de |
+------------------------------------------------+

 
 
 

Using GLUT with a free compiler under Windows

Post by Quin » Wed, 21 Aug 2002 06:37:03



says...

Quote:> It does in the sense that C in particular has had a huge (and IMHO
> negative) influence on the way we develop programs. Of course OpenGL is
> a C library, so we just have to live with all that that implies...

Could you care to elaborate on that ? I'm just curious.
 
 
 

Using GLUT with a free compiler under Windows

Post by Quin » Wed, 21 Aug 2002 06:36:23




Quote:> It isn't platform independent, and different implementations within a single
> platform contribute to the mess, as has already been commented on. I long
> for the day when C and C++ finally turn up their toes and die.

Yes it is platform independent. As long as you stay with ISO C (and with
ISO C compilers...).
You may have some slight differences on the numerical results, but that's
all.
Try to give a single example which prove that ISO C is platform
dependent.
 
 
 

Using GLUT with a free compiler under Windows

Post by Quin » Wed, 21 Aug 2002 06:31:33




Quote:> I've also tried compiling with LCC from within the IDE that comes with it
> but also get glut errors there.

I've managed to use GLUT with lcc (not without many hours...:-( ).
First try to find the glut32.lib designed especially for lcc (I don't
remember the URL, sorry). It's roughly 700ko (much bigger than the
standard one you can find).

And in the Project|Configuration|Linker add the following files IN THAT
ORDER : glut32.lib opengl32.lib tcconio.lib winmm.lib glu32.lib

Strangely enough, order has importance here...

HTH

 
 
 

Using GLUT with a free compiler under Windows

Post by Thant Tessma » Wed, 21 Aug 2002 07:19:01



> 1:
> OpenGL isn't a C library at all. It's a API with bindings to almost
> every major language.

It's an API with bindings available to any language *implementation*
that supports a given platform's C calling conventions. Since C is a de
facto standard for interfacing programs with the OS, this capability is
common. It is not, however, self-evidently the best foundation upon
which to build a graphics API. The OpenGL does not, for example, lend
itself to efficient use from languages that employ automatic memeory
management or non-C-like memory layout capabilities.

Quote:> 2:
> C/C++ in it's pure definition _are designed_ to be plattform
> independent. There are no platform specific keywords or standard library
> functions. All the plattform specific stuff is made using plattform
> specific libraries.

There is no such thing as hardware independence. There is an attempt by
C's designers and implementors to make it to work on a lot of different
hardware. And in turn, C's ubiquity has influenced the hardware that
gets designed and built. The impressive match between C and so much
popular hardware today is more a matter of co-evolution than any
universally-applicable portability design principles.

-thant

 
 
 

Using GLUT with a free compiler under Windows

Post by Charles E Hardwidg » Wed, 21 Aug 2002 07:30:03


Quote:>OpenGL isn't a C library at all. It's a API with bindings to almost
>every major language.

It's designed and built on top of C and what we have flows from that.

Quote:>C/C++ in it's pure definition _are designed_ to be
>plattform independent.

Types shoots a hole through that one. Even if that's not enough there is
enough slack in the spec to make implementations on the same system
incompatible. C/C++ is not platform independant.

--
Charles E Hardwidge
http://www.hardwidge.org.uk

 
 
 

Using GLUT with a free compiler under Windows

Post by Charles E Hardwidg » Wed, 21 Aug 2002 07:32:19


Quote:>Yes it is platform independent. As long as you stay with ISO C (and
>with ISO C compilers...).

No it's not. Platform and implementation differences due to holes in the
spec stop it from being portable.

--
Charles E Hardwidge
http://www.hardwidge.org.uk

 
 
 

Using GLUT with a free compiler under Windows

Post by Thant Tessma » Wed, 21 Aug 2002 07:36:30




> says...

>>It does in the sense that C in particular has had a huge (and IMHO
>>negative) influence on the way we develop programs. Of course OpenGL is
>>a C library, so we just have to live with all that that implies...

> Could you care to elaborate on that ? I'm just curious.

For example, one doesn't know how incredibly disruptive the
"debug-compile-execute" cycle is unless one has developed in an
interactive programming language. (I would say "interpreted" language,
but what often looks like "interpretation" is often really "incremental
compilation."

-thant

 
 
 

Using GLUT with a free compiler under Windows

Post by Danny Chapma » Wed, 21 Aug 2002 18:02:04



> Try to give a single example which prove that ISO C is platform
> dependent.

int a[2]; // probably aligned to a 4-byte boundary
char * b = (char *) a;
char * c = &b[2]; // c[0] points to half way through the int at a[0]
int d = *( (int *) c); // interpret c[0] as the start of an int

On a sparc this gives a bus error because of the misaligned memory access
when assigning to d. I believe (though I'm not in a position to test it)
that x86 allows misaligned memory accesses, so the assignment to d would
be fine.

I have to admit that I don't know if the above code is "ISO C". Anyway, if
C was truly platform dependant, it wouldn't let you write such dodgy code!

- Danny

 
 
 

Using GLUT with a free compiler under Windows

Post by Tsyra » Wed, 21 Aug 2002 17:46:38




Quote:> >Yes it is platform independent. As long as you stay with ISO C (and
> >with ISO C compilers...).

> No it's not. Platform and implementation differences due to holes in the
> spec stop it from being portable.

I'd be curious in an example too.
 
 
 

1. GLUT support in Windows compilers

I want to start with OpenGL programming and have installed Borland C++ 5.0
and Microsoft Visual C++ 5.0. Both have a include/gl directory with gl.h and
glu.h. However NEVER do they have a GLUT.h. And when I include one than I
get all kinds of compile errors.
Is there some other way I can program OpenGL in a platform independent way
or am I missing something else ?

Thanks,

Ton den Hartog

NB What is glaux.h ?

2. Carving Material with a laser....how to....

3. How to compile GLUT with Cygnus Windows compiler

4. How to 'place' a texture?

5. Need a free compiler for windows for openGL

6. Jobs for character animators in Madrid (Spain)

7. Help using Display Lists in Multiple Windows in GLUT

8. Gaffer vs. Realitools

9. How to utilize my 3dfx-card using GLUT (Windows)

10. GLUT and mingw32 compiler

11. GLUT on Win98 w/ Watcom Compiler

12. which compiler for Mesa + glide + glut on Win95?

13. WINDOWS COSTS, BLENDER FOR WINDOWS COSTS, LINUX IS FREE, BLENDER FOR LINUX IS FREE,