Unresolved external symbol

108 views
Skip to first unread message

Angry Penguin

unread,
Nov 24, 2023, 5:38:44 AM11/24/23
to ProjectChrono
Hello,
I compiled Chrono from sources and everything went without problems. The .exe demos work. The template project compiles without any problem as well. I wanted to start building my project, so I tried with simple examples. Unfortunately, I can't compile the CityBus demo using CMakeLists from the template, VS gets multiple (54) errors like this:
 
Error LNK2019 unresolved external symbol "__declspec(dllimport) class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl chrono::vehicle::GetDataFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_?GetDataFile@vehicle@chrono@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV34@@Z) referenced in function main
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: double __cdecl chrono::vehicle::ChVehicle::GetMass(void)const " (__imp_?GetMass@ChVehicle@vehicle@chrono@@QEBANXZ) referenced in function main
Error LNK2001 unresolved external symbol "public: virtual bool __cdecl chrono::vehicle::ChInteractiveDriverIRR::HasJoystick(void)const " (?HasJoystick@ChInteractiveDriverIRR@vehicle@chrono@@UEBA_NXZ)

What am I doing wrong? What am I missing?

Best regards

Angry Penguin

unread,
Nov 24, 2023, 8:20:33 AM11/24/23
to ProjectChrono
I've got it to work by adding additional .lib files (_vehicle, _vechicle_irrlicht) under Project Properties -> Linker -> Input -> Additional Dependencies. Can I somehow automate this in CMake to have all of required libraries filled in during generating Project?

Best Regards

Radu Serban

unread,
Nov 24, 2023, 8:36:33 AM11/24/23
to ProjectChrono

Assuming the CMakeLists.txt file you attached to your first message is what you are trying to use, that is incomplete.  You seem to be using the CMakeLists.txt provided as a sample with the template_project in the Chrono distribution, yet you are trying to use an additional module in Chrono (namely the vehicle module).  As indicated in the comments at the top of that file, you must modify that CMake script to request any additional Chrono modules that you want to use in the call to find_package(Chrono…).  In your case, in addition to the “Irrlicht” package, you must also request “Vehicle”.

 

Look at how various projects are set up in some other public repositories, such as chrono-tutorial and chrono-projects.  The projects there (including some that use Chrono::Vehicle) are all set up as “3rd party” projects, using a CMakeLists.txt like the one in template_projects, but modified appropriately.

 

--Radu

--
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 projectchron...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/projectchrono/718e2011-d299-409b-b799-dabb19a13f37n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages