Crystalspace builded, what to do now?

Apprentice
Posts: 10
Joined: 2008.02
Post: #1
Hello everyone

Just a question, I've builded crystalspace (finaly Wow), now I want to use it in XCode. What do I have to do? My CSLib is called libcrystalspace-1.2.a, I also have a library called libcrystalspace_macosx-1.2.a. How do I have to include them? Something like: #include "crystalspace.h" ?

In advanced thanks
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #2
General principle: Function prototypes (usually in header files) let the compiler know what symbols to expect to be available at link time; without them, compilation will fail (assuming you're using functions exported by the library). Static libraries (.a)/dylibs/frameworks contain implementations of the functions declared by the header, which allows the linker to resolve those symbols; without them, linking will fail. Including a header doesn't give you function implementations (unless they're implemented directly in the header itself or a file it includes), and linking with a library doesn't give you function prototypes.

So, in order to apply these principles to your situation, you'll need to make sure crystalspace.h is in a place somewhere in your header search paths, #include it in your code, and link with the appropriate .a file(s). I'm not familiar with crystalspace, so I don't know whether you'll need to link with libcrystalspace-1.2.a, libcrystalspace_macosx-1.2.a, or both, but try a few permutations and see what works. To link to it in Xcode, you can either add a path to it in OTHER_LDFLAGS, or add -lcrystalspace-1.2 and/or -lcrystalspace_macosx-1.2 to OTHER_LDFLAGS (making sure it's in one of your library search paths), or simply drag the file into your project.
Quote this message in a reply
Apprentice
Posts: 10
Joined: 2008.02
Post: #3
Thanks, but the problem isn't solved. When I build the project I get errors inside the crystalspace header files suchs as: csdef.h:32:19: error: cmath.h: No such file or directory, and math.h:147: error: 'isfinite' is not a member of 'std'.
I've already unchecked Zero link.
Any ideas?
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #4
The first one sounds like a header search path issue. Presumably, one of the crystalspace headers is indirectly including files which aren't in any path that's being searched. You'll need to locate cmath.h and add the path to it to your header search paths.

The second one sounds like a problem of mixing C and C++, but math.h and other standard headers generally wrap themselves in extern "C" {} when __cplusplus is defined, so I don't really know what's going on there. Someone else on the forum with more C++ experience might have some insight.
Quote this message in a reply
Apprentice
Posts: 10
Joined: 2008.02
Post: #5
Thanks, do you know someone with that C++ experience or a forum for C++/crystalspace?
Quote this message in a reply
Sage
Posts: 1,199
Joined: 2004.10
Post: #6
I'll wager crystalspace has a forum and/or mailing list.

In fact: http://www.crystalspace3d.org/forum/index.php
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #7
<cmath.h> *shouldn't* exist, and crystalspace shouldn't be using it Rasp The header's called <cmath>.
Quote this message in a reply
Post Reply