Hello guys,
I got these 2 errors while setting up my environment in Mac OS X following the instructions listed in: https://www.panda3d.org/manual/index.php/How_to_compile_a_CXX_Panda3D_program_on_Mac_OS_X
$g++ -c hello.cxx -o hello.o -fPIC -O2 -arch i386 -I /usr/include/python2.5/ -I /Developer/Panda3D/include/
In file included from hello.cxx:1:
In file included from /Developer/Panda3D/include/pandaFramework.h:20:
In file included from /Developer/Panda3D/include/windowFramework.h:19:
In file included from /Developer/Panda3D/include/nodePath.h:23:
In file included from /Developer/Panda3D/include/pandaNode.h:20:
In file included from /Developer/Panda3D/include/cycleData.h:19:
In file included from /Developer/Panda3D/include/typeHandle.h:19:
In file included from /Developer/Panda3D/include/typeRegistry.h:20:
In file included from /Developer/Panda3D/include/memoryBase.h:19:
In file included from /Developer/Panda3D/include/memoryHook.h:20:
In file included from /Developer/Panda3D/include/atomicAdjust.h:31:
In file included from /Developer/Panda3D/include/atomicAdjustI386Impl.h:56:
/Developer/Panda3D/include/atomicAdjustI386Impl.I:35:30: error: invalid lvalue
in asm input for constraint 'm'
:"m" (&var));
^~~~
/Developer/Panda3D/include/atomicAdjustI386Impl.I:62:30: error: invalid lvalue
in asm input for constraint 'm'
:"m" (&var) : "memory");
^~~~
2 errors generated.
I am running the latest stable Panda (1.8.1) in Mac OS X 10.8.4. (Python “Hello World” works perfectly but I need to work with C++).
This is the body of one of the functions that causes these errors (atomicAdjustI386Impl.I)
////////////////////////////////////////////////////////////////////
// Function: AtomicAdjustI386Impl::inc
// Access: Public, Static
// Description: Atomically increments the indicated variable.
////////////////////////////////////////////////////////////////////
INLINE void AtomicAdjustI386Impl::
inc(TVOLATILE AtomicAdjustI386Impl::Integer &var) {
assert((((size_t)&var) & (sizeof(Integer) - 1)) == 0);
#ifdef _M_IX86
// Windows case
TVOLATILE Integer *var_ptr = &var;
__asm {
mov edx, var_ptr;
lock inc dword ptr [edx];
}
#elif !defined(__EDG__)
// GCC case
__asm__ __volatile__("lock; incl %0"
:"=m" (var)
:"m" (&var));
#endif // __EDG__
}
Thanks in advance for your help!