This kind of issues are difficult to debug without a full working example.
My suspicion is that some JSON file is not found as expected.  Note that the 
JSON files referenced from the top-level vehicle JSON file must be provided 
relative to the vehicle data directory.

But all of this is not that relevant. Such an issue can *very* easily be 
identified by building the code in *Debug* mode and stepping through it with a 
debugger.  Step through each subsystem constructor and ensure that the JSON 
file it attempts to use is what you expect. Have you done that?

Radu

From: [email protected] <[email protected]> On Behalf 
Of Emrullah Cebeci
Sent: Monday, 10 November 2025 16:40
To: ProjectChrono <[email protected]>
Subject: [chrono] Project Chrono 0xC0000005 Crash - Access violation on 
vehicle.Initialize() (Custom JSON Loading Issue)


Hello, I am trying to load a custom vehicle in Project Chrono using JSON files, 
but I am receiving a 0xC0000005: Access violation (Null Pointer) error that I 
cannot solve.

The program always crashes when it reaches the vehicle.Initialize(...) line. 
This indicates that the WheeledVehicle constructor failed, and the vehicle 
object is being created as a null pointer (nullptr).

I believe the file references in my JSON files and my main.cpp code are 
correct. My JSON file structure is as follows:   
C:/Projects/vehicle_project/data/temp/vehicle/vehicle.json

Here is the relevant section of my main.cpp:

#include "chrono_vehicle/ChVehicleModelData.h"
// ... other includes ...

using namespace chrono;
using namespace chrono::vehicle;

int main() {

    // SetDataPath points to the 'data' directory from the file tree above
    const std::string vehicle_data_path = "C:/Projects/vehicle_project/data";
    chrono::vehicle::SetDataPath(vehicle_data_path);

    // The vehicle JSON is called relative to the 'data' directory
    const std::string vehfile = "temp/vehicle/Vehicle.json";
    WheeledVehicle vehicle(vehfile, ChContactMethod::SMC, false, false);

    // THE ERROR OCCURS ON THIS EXACT LINE
    vehicle.Initialize(ChCoordsys<>(ChVector3d(0, 0, 0.6), QuatFromAngleZ(0)));

    // ... (rest of the code)
}

I would greatly appreciate it if you could tell me what is causing this problem 
and how to solve it. Thank you.




--
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]<mailto:[email protected]>.
To view this discussion visit 
https://groups.google.com/d/msgid/projectchrono/4726cd2f-6b05-4bb9-8f99-66708abb54d5n%40googlegroups.com<https://urldefense.com/v3/__https:/groups.google.com/d/msgid/projectchrono/4726cd2f-6b05-4bb9-8f99-66708abb54d5n*40googlegroups.com?utm_medium=email&utm_source=footer__;JQ!!Mak6IKo!OuIEFyot2_gsXLCOsY0-A5jBZ-BnQCkPhaBDc-1X1EmuNBQMVr5N-wUdyLOFqpvXL7jK3LzSY-u-0jkXOC812P0s$>.

-- 
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 visit 
https://groups.google.com/d/msgid/projectchrono/CH3PPF46CDC2185B4277224A25B35325C09A7CFA%40CH3PPF46CDC2185.namprd06.prod.outlook.com.

Reply via email to