@SDL users, use OpenGL

Started by
91 comments, last by 23yrold3yrold 18 years, 1 month ago
I had to do a few of things to get it to compile on my machine:
1) #include <cstring> in hxSDL.cpp
2) #include <cstdlib> in hxrender.cpp
3) add
#ifndef NULL#define NULL 0L#endif
in hxrender.cpp
4) change #include <sdl.h> to #include <SDL.h>, some filesystems are case sensitive(such as the ones commonly used with linux)
Advertisement
Quote:Original post by Roboguy
I had to do a few of things to get it to compile on my machine:
1) #include <cstring> in hxSDL.cpp
2) #include <cstdlib> in hxrender.cpp
3) add
#ifndef NULL#define NULL 0L#endif
in hxrender.cpp
4) change #include <sdl.h> to #include <SDL.h>, some filesystems are case sensitive(such as the ones commonly used with linux)


um, what compiler are you using?
HxRender | Cornerstone SDL TutorialsCurrently picking on: Hedos, Programmer One
Quote:Original post by PnP Bios
Quote:Original post by Roboguy
I had to do a few of things to get it to compile on my machine:
1) #include <cstring> in hxSDL.cpp
2) #include <cstdlib> in hxrender.cpp
3) add
#ifndef NULL#define NULL 0L#endif
in hxrender.cpp
4) change #include <sdl.h> to #include <SDL.h>, some filesystems are case sensitive(such as the ones commonly used with linux)


um, what compiler are you using?
GCC 3.3, I said you should define NULL just in case they try to compile with gcc instead of g++(gcc doesn't define it, g++ does). As for the other things(except 4, that is only required for case-sensitive filesystems, but I recommend you do change it), they would probably be required no matter what machine you compile it on
Roboguy, will do.

I found a free wiki to use as a documentation site. As soon as I get a template going, I'll set you guys loose on it.
HxRender | Cornerstone SDL TutorialsCurrently picking on: Hedos, Programmer One
I've got a Linux version (static lib) if anyone wants to use it - available from here
Quote:Original post by Spudder
I've got a Linux version (static lib) if anyone wants to use it - available from here


You built the whole thing as one library?
Not what I had in mind, but, if it works..

Can I build static libraries for linux (.a files) using dev-c++?
HxRender | Cornerstone SDL TutorialsCurrently picking on: Hedos, Programmer One
Quote:Original post by PnP Bios
Can I build static libraries for linux (.a files) using dev-c++?
Probably, if it comes with ar(the UNIX archiving program which makes .a files). Also, you'll need the header files in addition to the library file for it to work. This is how you would make an archive with ar(if your using ar.exe, change 'ar' to 'ar.exe'):
ar lib<library name>.a <object files>

it should work on linux, assuming the object files are in the right format(OSX doesn't use the same format, but I can compile an OSX one for you). If it doesn't you could try using the gcc that comes with cygwin
From my experience compiling static libs with Dev-C++ for use under Linux has it problems, all I did was compile the source files into object files then archive them into an .a file. You still need to link to any third party libs like SDL with this file though.
Trying to compile under Linux....I'll give a quick summary of changes I had to make.

hxrender.cpp
Changed gl/gl.h to GL/gl.h and gl/glu.h to GL/glu.h
Include cstdlib

In hxiNextPowerOfTwo the pow(2, i) is ambiguous, and becasue i is an integer I just changed pow(2, i) to 1 << i

hxSDL.cpp:
Changed sdl.h to SDL.h
Included cstring

hxUtility.cpp:
Changed gl/gl.h to GL/gl.h and gl/glu.h to GL/glu.h
Added cstring

hxrender.h:
Removed extra code after #endif ignored but produces a warning on GCC.

Since these are .cpp files I changed the C headers to C++ style (cmath instead of math.h etc.)
I might have forgotten a change though...
I also made a very very basic Makefile and put it in a tarball. If you want it online I'll be glad to send it to you.
Quote:Original post by Cherez
Trying to compile under Linux....I'll give a quick summary of changes I had to make.

hxrender.cpp
Changed gl/gl.h to GL/gl.h and gl/glu.h to GL/glu.h
Include cstdlib

In hxiNextPowerOfTwo the pow(2, i) is ambiguous, and becasue i is an integer I just changed pow(2, i) to 1 << i

hxSDL.cpp:
Changed sdl.h to SDL.h
Included cstring

hxUtility.cpp:
Changed gl/gl.h to GL/gl.h and gl/glu.h to GL/glu.h
Added cstring

hxrender.h:
Removed extra code after #endif ignored but produces a warning on GCC.

Since these are .cpp files I changed the C headers to C++ style (cmath instead of math.h etc.)
I might have forgotten a change though...
I also made a very very basic Makefile and put it in a tarball. If you want it online I'll be glad to send it to you.


It seems like a bunch of people have made ports for this. Everybody who has made a port, or significant changes to the library, email them to me as zipped attachments.

pnpbios at hotmail dot com

I will post them all on my web site, get everything compatable with the zlib license, and make it so we can vote on who want's which port.

I'm glad to see so many people excited about this.

I am going to do some more work on the wiki today, like build a function template and stuff. It looks like this one is also flexable enough to handle tutorials as well as function explinations.
HxRender | Cornerstone SDL TutorialsCurrently picking on: Hedos, Programmer One

This topic is closed to new replies.

Advertisement