compiling openGL with C language

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.

Maybe:
#include <stdlib.h>

???

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

if the file you are compiling has a .c extension change it to .cpp, that might solve your problem

The extension of my file is .cpp
It is a very simple C program with OpenGL basics
My compiling line is bcc32 c rogram.cpp
It is than under Borland version 5
Other libraries are accepted but no stdlib and fstream.

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.

Try removing the #include <stdlib>, it is only needed with some C compilers. You may not need it with yours.

Originally posted by ida:
[b]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.[/b]

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.

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.

Originally posted by Deiussum:
[b]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. [/b]

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.

http://www.libsdl.org/
SDL is there easy tutorials also found on the page