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):
chrono::SetChronoDataPath("../data/");
vehicle::SetDataPath("../data/vehicle/");
Hope this helps!
Greetings, Marcel
On Thursday, June 30, 2022 at 9:02:14 AM UTC+2 [email protected] wrote:
> Dear all,
>
> I am trying to build a single project chrono demo:
>
> https://github.com/projectchrono/chrono/blob/develop/src/demos/vehicle/wheeled_models/demo_VEH_CityBus.cpp
>
> 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 voeux, Freya the Goddess
> Liebe Grüße, Freya the Goddess
> Best wishes, Freya the Goddess
> よろしくお願いします、Freya the Goddess
> 最好的祝福,Freya the Goddess
> Matakwa mema, Freya the Goddess
> مع أطيب التمنيات ، فريا الإلهة
>
--
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/679fcb35-b782-4e3b-b787-f81c2b1665b6n%40googlegroups.com.