Compilers

Hi,

What programs are used to create and compile OpenGL cos im keen to learn, and where can i download a copy pls?

Dehaz

I assume that you are using the windows OS.

I have created OpenGL apps using MS’s and Borland’s commercial compilers. I know people who use Borland’s free command line compiler to develop OpenGL applications. You can get download Borland’s compiler from a web page located somewhere on its site: www.borland.com

Yeah, don’t take this too hard, but…

if you’re asking questions like “what do I need to make an OpenGL program”, you are probably at least 50 kilometres away from learning OpenGL.

You should probably pick up books like “Teach Yourself C in 21 Days”, or “C++ For Dummies”, or whatever: basic progamming knowledge first, OpenGL much later.

I use GCC (http://www.mingw.org/). It’s free and I like it, but I haven’t got gdb to work properly on Windows, and you’d almost certainly want a debugger if you’re just learning C/C++.

I love Microsoft Visual C++ v6. even though it is not free, when i was a basic newbie it was easy to understand and pick up. also if your not orginized like me it does alot of it for you. I would tell you to go out and get this one now!

Originally posted by Lurking:
I love Microsoft Visual C++ v6. even though it is not free, when i was a basic newbie it was easy to understand and pick up. also if your not orginized like me it does alot of it for you. I would tell you to go out and get this one now!

Hmmm… “Not free”. The standard edition is $110, and the Pro edition is $550. GCC (MinGW) is $0, and there are plenty of good free C/C+±editors to chose from (check out http://www.blockdev.net/Community/Editors/windows.shtml).

And GCC is easy to pick up for a newbie too: write a C-file with a main() function, and compile with “gcc myprogram.c -o myprogram.exe”.

Well, then there is of course the “personal taste” factor to add as well. Personally, I detest the MS way of “the user is too stupid to know what he’s doing, so we do it for him”. I like the control that GCC gives me, and I like the fact that I can easily compile a program under both Windows and e.g. Linux with no or few modifications to the Makefile (provided that it is a portable program, such as a GLFW based OpenGL program).

/Marcus

[This message has been edited by marcus256 (edited 10-29-2001).]

Marcus256 do you have docs about the GCC?
The glut making problems.

Microsoft Visual C++ has to be one of the stupidest compilers I have ever seen. You don’t need to spend the extra hundred bucks to get a decent compiler. However, you do if you’re planning to use DirectX 8. This is why I use OpenGL instead of that junk, because even though their 140MB SDK download is free, their compiler isn’t, and, sadly, DirectX 8 is now compiler-specific. I use Borland myself to make OpenGL apps, and I’ve only known C/C++ for about a year.

As for Dehaz, all you really need is a C++ compiler, the OpenGL libs for the compiler if it doesn’t come with them (I use glut32.lib for Borland), and tutorials, like NeHe’s.

Oh yeah, and you need to know C++.

Originally posted by FoxDie:
Marcus256 do you have docs about the GCC?

http://www.gnu.org/software/gcc/onlinedocs/

The glut making problems.

What do you mean? Do you have trouble building GLUT? (I have not tried that?) I believe that MinGW supports GLUT (-lglut). I have noticed that GLUT programs do not compile under MinGW unless you:

  1. Include <windows.h> before including <GL/glut.h> - this should be easy to fix in the glut.h file somehow.
  2. Add -DGLUT_DISABLE_ATEXIT_HACK to the compiler line.

These are quick hacks - I don’t know what the REAL problems are.

/Marcus

Hah! I found the problem in the glut.h file:

Around line 23:

if (_MSC_VER >= 800) | | defined(_STDCALL_SUPPORTED)

should be changed to:

if (_MSC_VER >= 800) | | defined(_STDCALL_SUPPORTED) | | defined(MINGW32)

The GLUT_DISABLE_ATEXIT_HACK seems to be a problem with the libglut32.a file supplied with MinGW, which does not recognize the “atexit” workaround functions. Just add this line to the glut.h file somewhere in the beginning:

#define GLUT_DISABLE_ATEXIT_HACK

The real solution to this problem would be to build a new libglut32.a file from the latest GLUT distribution (haven’t done this).

/Marcus

In the linking is problem.
All needed libs are in /usr/libs.
I write to cmd-line for example
gcc -L/usr/lib -lGL -lGLU -lglut -o glapp glapp.c++

Then I reicive message about some undefined symbols.

When I use the command to build GLUT examples it works properly.

I have no idea whats wrong.

hey, men

I just wanna to use the glut-lib under bc5 and i’ve (i hope so) all *.dll’s, header-files, and the imported *.lib’s in the windows[it’s a 98]\system, \include\gl, lib\gl-directories.
also, i’ve made a project (win32.exe,GUI, nothing else marked) and added the glut32.lib to the .exe-node.
but everything i do, when compiling and building the project i get this message:
error: unresolved external ‘WinMain’ referenced from c:\bc5\lib\c0w32.obj
or similar one’s.
i’m just getting freaky here. i’ve spend over 2 weeks and haven’t found an answer in any html-doc.
is it just a stupid newbyerror?

LeQoq-

I haven’t written anything using Borland’s compiler in ages, but by any chance are you trying to compile a Windows app versus a console app (i.e. command line app)? The reason I’m asking is that for a Windows app you’ll need a WinMain function, and for a console app you’ll need a traditional main function.

It looks to me as if you’re trying to compile your command line console app as a Windows app, hence the “unresolved external: WinMain” linker error.

– sec

I use my Watcom compiler. Microsoft VC++ is the ugliest beast that I have ever encountered!
How to write unmaintainable, non-portable, incomprehensible code? Use VC++!

Watcom is noted for being very optimized, has a simple ide (just keep adding the files). You can make libs, dll’s, or just simple executables. Very nice toy.

All needed libs are in /usr/libs.
I write to cmd-line for example
gcc -L/usr/lib -lGL -lGLU -lglut -o glapp glapp.c++

…then you are not using Windows? Are you using Linux? You could try adding -L/usr/X11R6/lib aswell (that works at least for Linux).

Also, if you are writing a C++ program (glapp.c++), you should use g++ rather than gcc.

/Marcus

it’s true that the target model is GUI, but everyone i asked did so too.
i’ve read that only in msvc the model must be console.
well, i changed to console, and now a dos-box (my exe) opens a second window with the rendered pic.
so it works, but not the way i want.
what about adding the glut32.lib to the project?

Originally posted by FoxDie:
gcc -L/usr/lib -lGL -lGLU -lglut -o glapp glapp.c++
Then I reicive message about some undefined symbols.

You should write g++ glapp.c++ -L/usr/lib -lGL -lGLU -lglut -o glapp

While everyone is on the topic,
is there a good website that gives a quick tutorial on linking and compiling programs, I am constantly switching between gcc and c and cc etc (I am a unix user) Compiling and linking the libraries seems to be my biggest problem now too. ( I am a newbie at Opengl as well)

try www.linuxdoc.org, i think its in the howto section. i dont remember it being very linux specific, so it should help you out, even if you arent using linux…