CityBus Demo : path to CityBus_Vis.obj

Skip to first unread message

Freya the Goddess

Jun 30, 2022, 3:02:14 AM6/30/22
to ProjectChrono
Dear all,

I am trying to build a single project chrono demo:

I can create the executable, but when I run it, there is an error:
Error Loading OBJ file ../data/vehicle/citybus/CityBus_Vis.obj

segmentation fault.

If I compile the whole chrono, then of course demo_VEH_CityBus is working. I just want to try to compile single demo. Why it can't find the path to the CityBus object?

Thank You.

С наилучшими пожеланиями, Богиня Фрейя
Atenciosamente, Freya the Goddess
Meilleurs voeuxFreya the Goddess
Liebe Grüße, Freya the Goddess
Best wishes, Freya the Goddess
よろしくお願いします、Freya the Goddess
最好的祝福,Freya the Goddess
Matakwa mema, Freya the Goddess
مع أطيب التمنيات ، فريا الإلهة

Marcel Offermans

Jun 30, 2022, 3:19:47 AM6/30/22
to ProjectChrono
The obvious answer is that it is probably looking in the wrong place. That said, working out what the "current directory" is when running an executable can be a bit tricky depending on how you run it. So if you've built and executable for this demo, go to a command line and:
  1. Change directory to the folder where the executable lives.
  2. Make sure that from that folder, if you go one folder up, you see your "data" directory (and it actually contains the files you need to run this demo).
  3. Run the demo. It should now find the files.
Now if you're running inside the IDE (Visual Studio or whatever you are using) you can set this current directory to be whatever you want. What I have done to make my life a bit easier, is to add a few lines of code to the start of the main() of such demos that will print this directory:

// Output the current directory, just to make sure we understand where we're running.
#define PATH_MAX 1024
char buff[PATH_MAX];
_getcwd(buff, PATH_MAX);
std::string current_working_dir(buff);
GetLog() << "Working dir = " << current_working_dir << "\n\n";

Another thing that might help you is to explicitly set the data path. This was mentioned on the forum before, and you can do it somewhat like this (also do this at the start of main()):

// This can be used to point to different data paths (for core and vehicle modules):

Hope this helps!

Greetings, Marcel

Radu Serban

Jun 30, 2022, 4:47:42 AM6/30/22
to ProjectChrono

Marcel is correct.  When running a Chrono-based program from a location other than where the distribution demos are, you must point to the correct path for the various data files. 


Assuming you use the CMake Chrono project configuration script to link to the Chrono libraries either in a build directory or an install directory, you have access to a CMake variable (CHRONO_DATA_DIR) which contains the relevant information.   You must ensure this variable can be used from within your C++ code and then make a call such as


At the top of your main function.


See the example in the template_project and look at how (1) the CMake variable is used in CMakeLists.txt to define a C++ macro and (2) how that is used in the call to SetChronoDataPath in my_example.cpp.



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
To view this discussion on the web visit

Freya the Goddess

Jul 2, 2022, 3:27:04 AM7/2/22
to ProjectChrono
Thanks Marcel and Radu, I add the line :
inside the main() of the

Then the error changes. segmentation fault.

The build directory of Project Chrono is: /opt/hamzstlib/Physics/chrono2, where the data folder is there and the CityBus_Vis.obj is there too. You can see from my screenshot along with the newest error to run the executable.

Capture d’écran_2022-07-02_14-23-29.png

Freya the Goddess

Jul 2, 2022, 4:42:54 AM7/2/22
to ProjectChrono

 the distribution demos are in

still the same error
Capture d’écran_2022-07-02_15-40-15.png

Radu Serban

Jul 2, 2022, 5:17:02 AM7/2/22
to ProjectChrono

You also need to properly set the data path to Chrono::Vehicle data file.

Look at the repository.  I just added an example of building the CityBus demo as an external project in  This should be exactly what you are trying to do.



Radu Serban

Jul 2, 2022, 9:22:44 AM7/2/22
to ProjectChrono

I am confused as to what you are doing / trying to do.  
Also, these snapshots do not help at all. If anything, they make things even more confusing.  Please explain what you are doing and, if needed, attach relevant files or else copy text output to your messages.


Were you able to clone, configure, and build chrono-projects?  If yes, can you successfully run demo_VEF_CityBus from *within* chrono-projects?

If you were able to do the above, then look in the directory to see how the CMakeLists.txt is written and how demo_VEH_CityBus is modified and reproduce that in your own test. 






From: Freya the Goddess <>
Sent: Saturday, July 2, 2022 11:43 AM
To: Radu Serban <>
Subject: Re: [chrono] Re: CityBus Demo : path to CityBus_Vis.obj


I try the external project:


There is this error when I run make  after I run cmake (see the screenshots)


Reply all
Reply to author
0 new messages