Hi Alessandro,Before building the demo did you compile Chrono properly with no 
errors?At which commit is your code?Are you using the template_project 
right?Where and when did you pick the template project?Because for example the 
ChCollisionModel is not in the collision namespace anymore, thus suggesting 
that you picked some old version of Chrono and not the one in main.And/or are 
your Chrono and your template project coming from same commit?Can you send us 
the CMakeCache created in the build folder of your project?Are the demos coming 
with Chrono working fine? Dario
-------- Messaggio originale --------Da: Alessandro Petrella 
<[email protected]> Data: 21/12/23  18:58  (GMT+01:00) A: 
ProjectChrono <[email protected]> Oggetto: [chrono] Error building 
my_example.cpp Hi,i'm trying to build a  "my_example.cpp" file, following this 
guide:https://api.projectchrono.org/tutorial_install_project.htmlBut when i try 
to "make" the project, this error occurred me: 
root@6a250250b222:~/Desktop/workspace/my_chrono_project_1/build# make[ 50%] 
Building CXX object CMakeFiles/my_demo.dir/my_example.cpp.o[100%] Linking CXX 
executable my_demo/usr/bin/ld: CMakeFiles/my_demo.dir/my_example.cpp.o: 
warning: relocation against `_ZTVN6chrono11ChSystemNSCE' in read-only section 
`.text._ZN6chrono11ChSystemNSCD2Ev[_ZN6chrono11ChSystemNSCD5Ev]'/usr/bin/ld: 
CMakeFiles/my_demo.dir/my_example.cpp.o: in function 
`main':my_example.cpp:(.text+0x68): undefined reference to 
`chrono::SetChronoDataPath(std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> > const&)'/usr/bin/ld: 
my_example.cpp:(.text+0x9a): undefined reference to 
`chrono::ChSystemNSC::ChSystemNSC(bool)'/usr/bin/ld: 
my_example.cpp:(.text+0x17e): undefined reference to 
`chrono::ChBody::SetBodyFixed(bool)'/usr/bin/ld: my_example.cpp:(.text+0x1b0): 
undefined reference to 
`chrono::ChSystem::Add(std::shared_ptr<chrono::ChPhysicsItem>)'/usr/bin/ld: 
my_example.cpp:(.text+0x315): undefined reference to 
`chrono::ChSystem::Add(std::shared_ptr<chrono::ChPhysicsItem>)'/usr/bin/ld: 
my_example.cpp:(.text+0x522): undefined reference to 
`chrono::ChSystem::Add(std::shared_ptr<chrono::ChPhysicsItem>)'/usr/bin/ld: 
my_example.cpp:(.text+0x55a): undefined reference to 
`chrono::ChPhysicsItem::GetVisualShape(unsigned int) const'/usr/bin/ld: 
my_example.cpp:(.text+0x5a7): undefined reference to 
`chrono::ChVisualShape::SetColor(chrono::ChColor const&)'/usr/bin/ld: 
my_example.cpp:(.text+0x5df): undefined reference to 
`chrono::ChPhysicsItem::GetVisualShape(unsigned int) const'/usr/bin/ld: 
my_example.cpp:(.text+0x639): undefined reference to 
`chrono::GetChronoDataFile(std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> > const&)'/usr/bin/ld: 
my_example.cpp:(.text+0x65d): undefined reference to 
`chrono::ChVisualShape::SetTexture(std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> > const&, float, 
float)'/usr/bin/ld: my_example.cpp:(.text+0x6a8): undefined reference to 
`chrono::irrlicht::ChVisualSystemIrrlicht::ChVisualSystemIrrlicht()'/usr/bin/ld:
 my_example.cpp:(.text+0x6c1): undefined reference to 
`chrono::irrlicht::ChVisualSystemIrrlicht::SetWindowSize(unsigned int, unsigned 
int)'/usr/bin/ld: my_example.cpp:(.text+0x709): undefined reference to 
`chrono::irrlicht::ChVisualSystemIrrlicht::SetWindowTitle(std::__cxx11::basic_string<char,
 std::char_traits<char>, std::allocator<char> > const&)'/usr/bin/ld: 
my_example.cpp:(.text+0x736): undefined reference to 
`chrono::irrlicht::ChVisualSystemIrrlicht::Initialize()'/usr/bin/ld: 
my_example.cpp:(.text+0x77e): undefined reference to 
`chrono::GetChronoDataFile(std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> > const&)'/usr/bin/ld: 
my_example.cpp:(.text+0x797): undefined reference to 
`chrono::irrlicht::ChVisualSystemIrrlicht::AddLogo(std::__cxx11::basic_string<char,
 std::char_traits<char>, std::allocator<char> > const&)'/usr/bin/ld: 
my_example.cpp:(.text+0x80c): undefined reference to 
`chrono::GetChronoDataFile(std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> > const&)'/usr/bin/ld: 
my_example.cpp:(.text+0x825): undefined reference to 
`chrono::irrlicht::ChVisualSystemIrrlicht::AddSkyBox(std::__cxx11::basic_string<char,
 std::char_traits<char>, std::allocator<char> > const&)'/usr/bin/ld: 
my_example.cpp:(.text+0x861): undefined reference to 
`chrono::irrlicht::ChVisualSystemIrrlicht::AddTypicalLights()'/usr/bin/ld: 
my_example.cpp:(.text+0x8df): undefined reference to 
`chrono::irrlicht::ChVisualSystemIrrlicht::AddCamera(chrono::ChVector<double> 
const&, chrono::ChVector<double>)'/usr/bin/ld: my_example.cpp:(.text+0x8f8): 
undefined reference to 
`chrono::irrlicht::ChVisualSystemIrrlicht::AttachSystem(chrono::ChSystem*)'/usr/bin/ld:
 my_example.cpp:(.text+0x928): undefined reference to 
`chrono::irrlicht::ChVisualSystemIrrlicht::BeginScene()'/usr/bin/ld: 
my_example.cpp:(.text+0x937): undefined reference to 
`chrono::irrlicht::ChVisualSystemIrrlicht::Render()'/usr/bin/ld: 
my_example.cpp:(.text+0x946): undefined reference to 
`chrono::irrlicht::ChVisualSystemIrrlicht::EndScene()'/usr/bin/ld: 
my_example.cpp:(.text+0x961): undefined reference to 
`chrono::ChSystem::DoStepDynamics(double)'/usr/bin/ld: 
my_example.cpp:(.text+0x98b): undefined reference to 
`chrono::irrlicht::ChVisualSystemIrrlicht::Run()'/usr/bin/ld: 
my_example.cpp:(.text+0x9a3): undefined reference to 
`chrono::irrlicht::ChVisualSystemIrrlicht::~ChVisualSystemIrrlicht()'/usr/bin/ld:
 my_example.cpp:(.text+0xc31): undefined reference to 
`chrono::irrlicht::ChVisualSystemIrrlicht::~ChVisualSystemIrrlicht()'/usr/bin/ld:
 CMakeFiles/my_demo.dir/my_example.cpp.o: in function 
`chrono::ChClassFactory::IsClassRegistered(std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> > 
const&)':my_example.cpp:(.text._ZN6chrono14ChClassFactory17IsClassRegisteredERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN6chrono14ChClassFactory17IsClassRegisteredERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x11):
 undefined reference to 
`chrono::ChClassFactory::GetGlobalClassFactory()'/usr/bin/ld: 
CMakeFiles/my_demo.dir/my_example.cpp.o: in function 
`chrono::ChClassFactory::IsClassRegistered(std::type_index 
const&)':my_example.cpp:(.text._ZN6chrono14ChClassFactory17IsClassRegisteredERKSt10type_index[_ZN6chrono14ChClassFactory17IsClassRegisteredERKSt10type_index]+0x11):
 undefined reference to 
`chrono::ChClassFactory::GetGlobalClassFactory()'/usr/bin/ld: 
CMakeFiles/my_demo.dir/my_example.cpp.o: in function 
`chrono::ChClassFactory::GetClassTagName[abi:cxx11](std::type_index 
const&)':my_example.cpp:(.text._ZN6chrono14ChClassFactory15GetClassTagNameB5cxx11ERKSt10type_index[_ZN6chrono14ChClassFactory15GetClassTagNameB5cxx11ERKSt10type_index]+0x11):
 undefined reference to 
`chrono::ChClassFactory::GetGlobalClassFactory()'/usr/bin/ld: 
CMakeFiles/my_demo.dir/my_example.cpp.o: in function 
`chrono::ChSystemNSC::~ChSystemNSC()':my_example.cpp:(.text._ZN6chrono11ChSystemNSCD2Ev[_ZN6chrono11ChSystemNSCD5Ev]+0x13):
 undefined reference to `vtable for chrono::ChSystemNSC'/usr/bin/ld: 
my_example.cpp:(.text._ZN6chrono11ChSystemNSCD2Ev[_ZN6chrono11ChSystemNSCD5Ev]+0x26):
 undefined reference to `chrono::ChSystem::~ChSystem()'/usr/bin/ld: 
CMakeFiles/my_demo.dir/my_example.cpp.o: in function `void 
__gnu_cxx::new_allocator<chrono::ChBodyEasyBox>::construct<chrono::ChBodyEasyBox,
 int, int, int, int, bool, bool>(chrono::ChBodyEasyBox*, int&&, int&&, int&&, 
int&&, bool&&, 
bool&&)':my_example.cpp:(.text._ZN9__gnu_cxx13new_allocatorIN6chrono13ChBodyEasyBoxEE9constructIS2_JiiiibbEEEvPT_DpOT0_[_ZN9__gnu_cxx13new_allocatorIN6chrono13ChBodyEasyBoxEE9constructIS2_JiiiibbEEEvPT_DpOT0_]+0x18d):
 undefined reference to `chrono::ChBodyEasyBox::ChBodyEasyBox(double, double, 
double, double, bool, bool, std::shared_ptr<chrono::ChMaterialSurface>, 
std::shared_ptr<chrono::collision::ChCollisionModel>)'/usr/bin/ld: 
CMakeFiles/my_demo.dir/my_example.cpp.o: in function `void 
__gnu_cxx::new_allocator<chrono::ChBodyEasyBox>::construct<chrono::ChBodyEasyBox,
 double, int, double, int, bool, bool>(chrono::ChBodyEasyBox*, double&&, int&&, 
double&&, int&&, bool&&, 
bool&&)':my_example.cpp:(.text._ZN9__gnu_cxx13new_allocatorIN6chrono13ChBodyEasyBoxEE9constructIS2_JdidibbEEEvPT_DpOT0_[_ZN9__gnu_cxx13new_allocatorIN6chrono13ChBodyEasyBoxEE9constructIS2_JdidibbEEEvPT_DpOT0_]+0x183):
 undefined reference to `chrono::ChBodyEasyBox::ChBodyEasyBox(double, double, 
double, double, bool, bool, std::shared_ptr<chrono::ChMaterialSurface>, 
std::shared_ptr<chrono::collision::ChCollisionModel>)'/usr/bin/ld: 
CMakeFiles/my_demo.dir/my_example.cpp.o: in function `void 
__gnu_cxx::new_allocator<chrono::ChLinkMateGeneric>::construct<chrono::ChLinkMateGeneric,
 bool, bool, bool, bool, bool, bool>(chrono::ChLinkMateGeneric*, bool&&, 
bool&&, bool&&, bool&&, bool&&, 
bool&&)':my_example.cpp:(.text._ZN9__gnu_cxx13new_allocatorIN6chrono17ChLinkMateGenericEE9constructIS2_JbbbbbbEEEvPT_DpOT0_[_ZN9__gnu_cxx13new_allocatorIN6chrono17ChLinkMateGenericEE9constructIS2_JbbbbbbEEEvPT_DpOT0_]+0xd3):
 undefined reference to `chrono::ChLinkMateGeneric::ChLinkMateGeneric(bool, 
bool, bool, bool, bool, bool)'/usr/bin/ld: 
CMakeFiles/my_demo.dir/my_example.cpp.o: in function `void 
__gnu_cxx::new_allocator<chrono::collision::ChCollisionModelBullet>::construct<chrono::collision::ChCollisionModelBullet>(chrono::collision::ChCollisionModelBullet*)':my_example.cpp:(.text._ZN9__gnu_cxx13new_allocatorIN6chrono9collision22ChCollisionModelBulletEE9constructIS3_JEEEvPT_DpOT0_[_ZN9__gnu_cxx13new_allocatorIN6chrono9collision22ChCollisionModelBulletEE9constructIS3_JEEEvPT_DpOT0_]+0x31):
 undefined reference to 
`chrono::collision::ChCollisionModelBullet::ChCollisionModelBullet()'/usr/bin/ld:
 CMakeFiles/my_demo.dir/my_example.cpp.o: in function `void 
chrono::ChClassFactory::archive_out<chrono::ChCoordsys<double> 
>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> 
> const&, chrono::ChArchiveOut&, 
chrono::ChCoordsys<double>*)':my_example.cpp:(.text._ZN6chrono14ChClassFactory11archive_outINS_10ChCoordsysIdEEEEvRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERNS_12ChArchiveOutEPT_[_ZN6chrono14ChClassFactory11archive_outINS_10ChCoordsysIdEEEEvRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERNS_12ChArchiveOutEPT_]+0x1a):
 undefined reference to 
`chrono::ChClassFactory::GetGlobalClassFactory()'/usr/bin/ld: 
CMakeFiles/my_demo.dir/my_example.cpp.o: in function `void 
chrono::ChClassFactory::archive_out_constructor<chrono::ChCoordsys<double> 
>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> 
> const&, chrono::ChArchiveOut&, 
chrono::ChCoordsys<double>*)':my_example.cpp:(.text._ZN6chrono14ChClassFactory23archive_out_constructorINS_10ChCoordsysIdEEEEvRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERNS_12ChArchiveOutEPT_[_ZN6chrono14ChClassFactory23archive_out_constructorINS_10ChCoordsysIdEEEEvRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERNS_12ChArchiveOutEPT_]+0x1a):
 undefined reference to 
`chrono::ChClassFactory::GetGlobalClassFactory()'/usr/bin/ld: 
CMakeFiles/my_demo.dir/my_example.cpp.o: in function `void 
chrono::ChClassFactory::archive_in<chrono::ChQuaternion<double> 
>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> 
> const&, chrono::ChArchiveIn&, 
chrono::ChQuaternion<double>*)':my_example.cpp:(.text._ZN6chrono14ChClassFactory10archive_inINS_12ChQuaternionIdEEEEvRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERNS_11ChArchiveInEPT_[_ZN6chrono14ChClassFactory10archive_inINS_12ChQuaternionIdEEEEvRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERNS_11ChArchiveInEPT_]+0x1a):
 undefined reference to 
`chrono::ChClassFactory::GetGlobalClassFactory()'/usr/bin/ld: 
CMakeFiles/my_demo.dir/my_example.cpp.o: in function `void 
chrono::ChClassFactory::archive_in<chrono::ChVector<double> 
>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> 
> const&, chrono::ChArchiveIn&, 
chrono::ChVector<double>*)':my_example.cpp:(.text._ZN6chrono14ChClassFactory10archive_inINS_8ChVectorIdEEEEvRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERNS_11ChArchiveInEPT_[_ZN6chrono14ChClassFactory10archive_inINS_8ChVectorIdEEEEvRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERNS_11ChArchiveInEPT_]+0x1a):
 undefined reference to 
`chrono::ChClassFactory::GetGlobalClassFactory()'/usr/bin/ld: 
CMakeFiles/my_demo.dir/my_example.cpp.o: in function `void 
chrono::ChClassFactory::archive_in<chrono::ChCoordsys<double> 
>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> 
> const&, chrono::ChArchiveIn&, 
chrono::ChCoordsys<double>*)':my_example.cpp:(.text._ZN6chrono14ChClassFactory10archive_inINS_10ChCoordsysIdEEEEvRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERNS_11ChArchiveInEPT_[_ZN6chrono14ChClassFactory10archive_inINS_10ChCoordsysIdEEEEvRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERNS_11ChArchiveInEPT_]+0x1a):
 undefined reference to 
`chrono::ChClassFactory::GetGlobalClassFactory()'/usr/bin/ld: 
CMakeFiles/my_demo.dir/my_example.cpp.o:my_example.cpp:(.text._ZN6chrono14ChClassFactory11archive_outINS_12ChQuaternionIdEEEEvRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERNS_12ChArchiveOutEPT_[_ZN6chrono14ChClassFactory11archive_outINS_12ChQuaternionIdEEEEvRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERNS_12ChArchiveOutEPT_]+0x1a):
 more undefined references to `chrono::ChClassFactory::GetGlobalClassFactory()' 
follow/usr/bin/ld: warning: creating DT_TEXTREL in a PIEcollect2: error: ld 
returned 1 exit statusmake[2]: *** [CMakeFiles/my_demo.dir/build.make:99: 
my_demo] Error 1make[1]: *** [CMakeFiles/Makefile2:83: 
CMakeFiles/my_demo.dir/all] Error 2make: *** [Makefile:91: all] Error 2thanks 
for the helpAP



-- 
You received this message because you are subscribed to the Google Groups 
"ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/projectchrono/4236ecaf-75b6-4100-a861-d07fa7dc89dan%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/projectchrono/65848b3f.170a0220.308a5.460e%40mx.google.com.

Reply via email to