[ODE] ODE and OPCODE

Elijah Taylor eatmailinglists at gmail.com
Tue Sep 5 14:54:01 MST 2006


I think you may not be understanding namespaces correctly... consider this:

namespace ns1
{
   void foo1()
   {
   }
}
using namespace ns1;

namespace ns2
{
   void foo2()
   {
      foo1();
   }
}

This compiles fine (at least with gcc).  The ns2 namespace doesn't "cancel"
any other namespaces you're using, you're still able to reference names in
the global namespace and any other namespace that's currently scoped in.

Again, I'm not exactly sure about the standard makefile that comes bundled
with ODE, but for my needs, I just compile all of the relevant c/cpp files
into .o files and link them together with my app, no special care taken
whatsoever, and it just works.

I did have problems initially when I made modifications to ordering of
includes and whatnot when doing what I thought were necessary changes to rid
the projects of precompiled headers, so are you sure you haven't modified
the source that could be causing an incorrect include path?

-Elijah

On 9/5/06, Wesley Smith <wesley.hoke at gmail.com> wrote:
>
> The problem is that there is still that in Opcode.h, there this:
>
> #include "OPC_IceHook.h"
>
>         namespace Opcode
>         {
>                 // Bulk-of-the-work
>                 #include "OPC_Settings.h"
>                 #include "OPC_Common.h"
>       // more stuff ...
>        }
>
> At the end of OPC_IceHooh.h as you pointed out there is using
> namespace IceMaths;, but this is negated by namespace Opcode causing
> my problems in OPC_Common.h.  Is there a compiler setting for getting
> around this?  How does the Makefile handle this?
>
> thanks,
> wes
>
> On 9/5/06, Elijah Taylor <eatmailinglists at gmail.com> wrote:
> > Yes, the namespaces are a bit goofy, especially if you look in
> > OPC_IceHook.h, which is what allows these structures that are included
> to be
> > used:
> >
> > ////// begin code
> > namespace IceMaths
> > {
> >     ...
> >     #include "Ice/IcePoint.h"
> >     ...
> > }
> >
> > using namespace IceMaths;
> > ////// end code
> >
> > So there are namespaces declared that these things go into, but they're
> > immediately made visible by "using namespace foo;" right after the
> > declaration.  I don't really know what the point of this is, but that's
> how
> > it works.
> >
> > -Elijah
> >
> >
> > On 9/5/06, Wesley Smith <wesley.hoke at gmail.com> wrote:
> > >
> >  Thanks for the responses so far.  I've been looking a bit more
> > carefully through the headere files.  Here's what I've noticed about
> > my errors:
> >
> > I'm getting an error in OPC_Common.h: "Point not defined".
> >
> > In collision_trimesh_internal.h, Opcode.h is included
> > |
> > |
> > > In Opcode.h,  OPC_IceHook.h is included
> >      |
> >      |
> >      |> In OPC_IceHook.h within namespace IceMaths, Ice/IcePoint.h
> > where Point is defined
> > |
> > |
> > |>In Opcode.h, in namespace Opcode OPC_Common.h is included
> >
> >
> > Given this structure with the order of includes and namespaces, I
> > don't see how the definition of Point in IcePoint.h can make it to
> > OPC_Common.h.  How on Earth does it get through those namespace
> > declarations?  Yes, the header files are in the right order, meaning
> > that Point is theoretically defined in the headerse before
> > OPC_Common.h comes along, but given the rules of C++ I don't see how
> > it would be in the same namespace.
> >
> > Anyone have insights here?
> >
> > thanks,
> > wes
> > _______________________________________________
> > ODE mailing list
> > ODE at q12.org
> >  http://q12.org/mailman/listinfo/ode
> >
> >
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://q12.org/pipermail/ode/attachments/20060905/14cfad87/attachment.htm


More information about the ODE mailing list