PDA

View Full Version : compiling openGL with C language



ida
04-29-2002, 07:08 AM
I am a beginner to graphics and to OpenGL.
I can see in the program examples in the book 'OpenGL Premier' that the "include <stdlib> appears together with openGL. When I compile it, it gives me the next error:
Error E2337 c:\Borland\include\stdlibr.h 584: only one of a set of overloaded functions can be 'C'.
Therefore I can not use stdlib or fstream or some others to produce.

Can you tell me how can I do, to be able to compile it (under Windows, Borland 5) with stdlib librarie from C language, as I have seen on the examples on the book from OpenGL.

I wait for your answers, Thank you.

nickels
04-29-2002, 07:17 AM
Maybe:
#include <stdlib.h>

??????

#include<stdlib>
might be some horrific C++ thing.

chowe6685
04-29-2002, 07:21 AM
if the file you are compiling has a .c extension change it to .cpp, that might solve your problem

ida
04-29-2002, 07:28 AM
The extension of my file is .cpp
It is a very simple C program with OpenGL basics
My compiling line is bcc32 c http://www.opengl.org/discussion_boards/ubb/tongue.gifrogram.cpp
It is than under Borland version 5
Other libraries are accepted but no stdlib and fstream.

Deiussum
04-29-2002, 08:37 AM
From the error, it sounds sort of like you have 2 functions of the same name being declared extern "C". Possibly you are using

#include <cstdlib>

using namespace std;

And somewhere else has #include <stdlib.h>?

That SHOULDN'T cause a problem because cstdlib should basically just wrap stdlib.h in the std namespace. Not sure what else the problem could be, though.

nexusone
04-29-2002, 08:54 AM
Try removing the #include <stdlib>, it is only needed with some C compilers. You may not need it with yours.


Originally posted by ida:
I am a beginner to graphics and to OpenGL.
I can see in the program examples in the book 'OpenGL Premier' that the "include <stdlib> appears together with openGL. When I compile it, it gives me the next error:
Error E2337 c:\Borland\include\stdlibr.h 584: only one of a set of overloaded functions can be 'C'.
Therefore I can not use stdlib or fstream or some others to produce.

Can you tell me how can I do, to be able to compile it (under Windows, Borland 5) with stdlib librarie from C language, as I have seen on the examples on the book from OpenGL.

I wait for your answers, Thank you.

04-29-2002, 10:14 AM
if you are using new glut (3.7.?) it is usual. find older glut from somewhere. new glut has problems with borland compilers with namespace errors and the creator of glut doesn't seem work with glut anymore. try SDL or something else. don't change to pure c. it totally sucks. c++ is far more better.

ida
05-01-2002, 06:48 AM
Originally posted by borlander:
if you are using new glut (3.7.?) it is usual. find older glut from somewhere. new glut has problems with borland compilers with namespace errors and the creator of glut doesn't seem work with glut anymore. try SDL or something else. don't change to pure c. it totally sucks. c++ is far more better.

Thanks a lot, I am using glut 3.7. What is SDL? How can I get it?, I am new to this things and I have to finish a program in a few days and I can not becouse I need stdio, stdlib and fstream from C with OpenGl, your answer might be a solution.

ida
05-01-2002, 06:53 AM
Originally posted by Deiussum:
From the error, it sounds sort of like you have 2 functions of the same name being declared extern "C". Possibly you are using

#include <cstdlib>

using namespace std;

And somewhere else has #include <stdlib.h>?

That SHOULDN'T cause a problem because cstdlib should basically just wrap stdlib.h in the std namespace. Not sure what else the problem could be, though.

Thank you, how can I see if I am declaring it as extern "C"?, cstdilib works but no with stdio or fstream and I need them together with openGL. I am using glut 3.7, and someone told me that it may cause inconveniences and use STD, what is it and how can I get it? I am new to this things but I am doing a program with OpenGL and C I need to handle in a few days.

05-01-2002, 12:06 PM
http://www.libsdl.org/
SDL is there easy tutorials also found on the page