odd circular definition issue

Simbody is useful for internal coordinate and coarse grained molecule modeling, large scale mechanical models like skeletons, and anything else that can be modeled as bodies interconnected by joints, acted upon by forces, and restricted by constraints.
POST REPLY
User avatar
Samuel Flores
Posts: 189
Joined: Mon Apr 30, 2007 1:06 pm

odd circular definition issue

Post by Samuel Flores » Sat Oct 13, 2018 4:59 am

Hi Sherm,

I am having another problem you might be able to help with. I wrote a piece of code a couple of years ago that I am trying to compile on a new machine. However I am suddenly having circular definition issues related to simbody. To debug, I wrote a simple program:

#include "/usr/local/MMB/include/simbody/SimTKsimbody.h"
#include <iostream>
int main (){
std::cout<<"howdy"<<std::endl;
}

Then I compile as:

g++ helloworld.cpp -o helloworld.exec -I/usr/local/SimTK/include/ -I/usr/local/SimTK/include/simbody

.. where /usr/local/SimTK has the usual simbody and molmodel install (molmodel is not needed for this though). simbody passes all its tests. helloworld.exec actually works, but it spits out the warnings which in my real program turn into errors, which I append below. I have never encountered this before and am not sure why it plagues me now. I suspect it is something stupid about the order in which the files are included, but I have played for a while and been unable to fix it. Any quick insight?

thanks

Sam



In file included from /usr/local/MMB/include/simbody/SimTKcommon/basics.h:43:0,
from /usr/local/MMB/include/simbody/SimTKcommon.h:32,
from /usr/local/MMB/include/simbody/SimTKsimbody.h:43,
from helloworld.cpp:2:
/usr/local/MMB/include/simbody/SimTKcommon/internal/Measure.h: In constructor SimTK::Measure_<T>::Plus::Plus(SimTK::Subsystem&, const SimTK::Measure_<T>&, const SimTK::Measure_<T>&):
/usr/local/MMB/include/simbody/SimTKcommon/internal/Measure.h:603:34: warning: invalid use of incomplete type const class SimTK::Subsystem
( this->getSubsystem().isSameSubsystem(left.getSubsystem())
~~~~~~~~~~~~~~~~~~^~
/usr/local/MMB/include/simbody/SimTKcommon/internal/ExceptionMacros.h:282:13: note: in definition of macro SimTK_ERRCHK_ALWAYS
do{if(!(cond))SimTK_THROW3(SimTK::Exception::ErrorCheck, \
^~~~
In file included from /usr/local/MMB/include/simbody/SimTKcommon.h:37:0,
from /usr/local/MMB/include/simbody/SimTKsimbody.h:43,
from helloworld.cpp:2:
/usr/local/MMB/include/simbody/SimTKcommon/internal/Measure.h:128:7: note: forward declaration of class SimTK::Subsystem
class Subsystem;

User avatar
Samuel Flores
Posts: 189
Joined: Mon Apr 30, 2007 1:06 pm

Re: odd circular definition issue

Post by Samuel Flores » Sat Oct 13, 2018 2:13 pm

I guess i needed to use

-isystem /usr/local/SimTK/include/simbody

Not sure I fully understand but in any case it is consistent with changing the search order..

POST REPLY