Yes, I did what you suggested. When I debugged the code, I noticed that the 
'vehicle.json' file could not be read, and the system was returning a null 
value. I checked the location and content of all other files referenced in 
the 'vehicle.json' file and could not see any issues.

Initially, I thought the GetDataFile function wasn't returning the correct 
file directory. However, I encountered the same problem even when I 
bypassed that function and manually hard-coded the direct path into the 
code.

To check if the problem was with the JSON files I created, I tried using 
the standard HMMWV JSON files that come with the Chrono installation, but 
the issue persisted.

11 Kasım 2025 Salı tarihinde saat 12:23:06 UTC+3 itibarıyla Radu Serban 
şunları yazdı:

> 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].
> 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/429ba68e-fd53-480b-b4f7-ab6fb7faee38n%40googlegroups.com.

Reply via email to