Page 1 of 1

odd circular definition issue

Posted: Sat Oct 13, 2018 4:59 am
by sam
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;

Re: odd circular definition issue

Posted: Sat Oct 13, 2018 2:13 pm
by sam
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..