View Full Version : ODE Problems
Geppy
2005.03.15, 08:15 PM
I've downloaded ODE, built it, and put it in the correct locations. Now I'm ready to use it in my C++ Xcode project but when i simply include it (as in #include <ode/ode.h>) Xcode chokes on this:
In file included from /usr/include/ode/ode.h:34,
/usr/include/ode/odemath.h:122: error: declaration of C function `double dDISTANCE(const double*, const double*)' conflicts with
/usr/include/ode/odemath.h:120: error: previous declaration `float dDISTANCE(const float*, const float*)' here
/usr/include/ode/odemath.h:180: error: template with C linkage
/usr/include/ode/odemath.h:181: error: template with C linkage
/usr/include/ode/odemath.h:182: error: template with C linkage
/usr/include/ode/odemath.h:183: error: template with C linkage
/usr/include/ode/odemath.h:184: error: template with C linkage
/usr/include/ode/odemath.h:185: error: template with C linkage
/usr/include/ode/odemath.h:187: error: template with C linkage
/usr/include/ode/odemath.h:188: error: template with C linkage
/usr/include/ode/odemath.h:189: error: template with C linkage
/usr/include/ode/odemath.h:190: error: template with C linkage
/usr/include/ode/odemath.h:191: error: template with C linkage
/usr/include/ode/odemath.h:192: error: template with C linkage
What's that about??? Did I do something wrong? I've been looking but can't find any answers. Thanks!
TomorrowPlusX
2005.03.16, 09:47 AM
Did you download the official 0.5 release? Or did you get it from CVS?
I've had *bad* luck with ODE CVS in the past -- it's best to go with the official build.
Fenris
2005.03.16, 10:56 AM
That looks like you're including the ODE headers in a .cpp file, which will break the linkage to hell. Bracket your inclusion of the ode headers with
extern "C"
{
// Add your headers here
#include "ode.h"
}
Geppy
2005.03.16, 12:00 PM
I'm using the official v0.5 release. And before I built i changed the user-settings file so that "PLATFORM=osx". Everything built without error. I copied the contents of ode-0.5/lib/ to /usr/lib/ and the contents of ode-0.5/include to /usr/include/
Is that correct? Maybe I'm not setting up my Xcode project correctly? I thought all i had to do was include <ode/ode.h> and i'd be set. Do i have to add anything to the project?
I tried using the extern "C"
{
#include "ode.h"
}
but that didn't work. If i do it that way i have to add "/usr/include/ode/" as a header search path for my project. So I added that and then got the same errors from my first post!
HELP!! :???:
Fenris
2005.03.16, 12:02 PM
Try:
extern "C"
{
#include <ode.h> // <-- note the brackets, not quotes
}
edit: also remove that search path you added... :)
Geppy
2005.03.16, 12:13 PM
Hey thanks for the quick reply Fenris!
I tried that (using #include <ode.h> instead of "ode.h") and if just says "ode.h: No such file or directory".....
And if i try #include <ode/ode.h> inside of the extern "C" brackets i just get those original errors again. This is really puzzling to me. Surely it can't be that hard to get this working....
:\
Fenris
2005.03.16, 12:16 PM
Hm, I haven't used ODE myself, so excuse me if this question is obvious: is this a framework, a shared library or what?
And NP, by he way, I'm just relieved other people have non-working code. ;)
Geppy
2005.03.16, 12:23 PM
ODE is the Open Dynamics Engine ( http://www.ode.org ). Its basically a physics engine that is very portable. Unfortunately the documentation online is a little lacking regarding getting it running on OS X.
Fenris
2005.03.16, 12:46 PM
Ah, yes, I know that much. ;) I'm just wondering what the "format" of it is a framework, or a shared library or what. How did you compile it? Command-line, XCode...? (Or, give me a URL to the source, and I'll look myself if you don't know) :)
lightbringer
2005.03.16, 01:07 PM
Static library is by default what the makefile creates.
Are you maybe not using extern in the right file(s)?
That _should_ work.
Geppy
2005.03.16, 01:16 PM
The version i'm using can be downloaded here (http://prdownloads.sourceforge.net/opende/ode-0.5.tgz?download) .
It builds a library that I then move to /usr/lib/
I assume I also need to add that built library (libode.a) to my project?
TomorrowPlusX
2005.03.16, 05:02 PM
This is really weird. I've never seen any troubles like that. You *should* be able to include <ode/ode.h> from anywhere, without bracketing.
My personal setup doesn't involve copying ode to /usr -- I keep a local copy of the lib and the headers in a file structure such as:
ProjectRoot/
include/
ode/
freetype/
etc...
lib/
libode.a
libfreetype.a
etc...
And then in my build settings I add include/ to the header search path. The headers themselves are unmodified.
In case you're wondering why I take this approach, it's to make it easier to work on difference machines without having to muck around in usr/ -- plus, it makes it easier to use different versions of libs in different projects.
Anyway, this works for me...
phydeaux
2005.03.16, 05:26 PM
It sounds like the opposite of the extern "C" problem- somewhere the ode include is in an extern "C" block when it shouldn't. The reason why I suspect this is that the first problem in question- "declaration of C function `double dDISTANCE... "- is supposed to be compiled in C++, so that the two dDISTANCE functions will have different signatures, and the second problem in question about "template with C linkage" means that the compiler is trying to compile C code, but it found the template keyword.
ODE actually does take advantage of some C++ features, which is where this problem is coming from. Provided the library has been compiled with C++, you don' t need the extern "C" block around the include.
So possibly we should see how you are including the .h files (so, your source code where you include ode), and also what the compile string is (what arguments to g++ is XCode trying to use?)
Geppy
2005.03.16, 07:12 PM
First of all, thank you to everyone for all the help!
My project has a fairly complex structure because it includes a lot of files and makes use of a precompiled prefix header. Rather than post a bunch of code that is very likely not the cause of my problems I made a new test project for you to look at. All I did was start a new project in Xcode using "New Project..." --> "C++ Tool". Then I simply changed the automatically created main.cpp file to read as this:
#include <ode/ode.h>
#include <iostream>
using namespace std;
int main (int argc, char * const argv[])
{
// insert code here...
cout << "Hello, World!" << endl;
return 0;
}
That's all it takes to generate the exact same errors as my first post. If you want I can post this sample project. Am i just being stupid and doing something wrong?
I'm having similar problems and am not even sure I'm doing any of the setup/installation right. Can someone here quick type up brief tutorial on 'installing' and using ODE (just to the extent of including it, not necessarily how to do anything)? That would help a lot. Thanks.
Bah, use Newton (http://www.physicsengine.com/). ;)
PowerMacX
2005.03.17, 01:24 AM
OK, I got this to compile (doesn't actually mean it does anything)
#include "ode/ode.h"
#include <iostream>
int main (int argc, char * const argv[]) {
// insert code here...
std::cout << "Hello, World!\n";
return 0;
}
simply creating a C++ tool, copying libode.a & the ode headers folder into the project folder and adding "." as a header search path (why is this last step necesary I don't know :wacko: - adding the ode folder & it's contents to the project didn't work)
Geppy
2005.03.18, 02:29 PM
Thanks! :)
I got it to work! This seems kinda odd to do it this way but whatever....
You made my day!
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.