"File not found" error when running a game on a device

Hi, I've been playing around with the C API recently and everything was working very well while testing in the simulator. However I just tried running the game on a simulator and it immediately crashes with very enigmatic message: "File not found.". I using the "Upload Game to Device..." but no difference in the behavior. I initially thought this is probably an issue on my side however I then tried few other examples from the C_API directory and all of them crash at the beginning, some have different errors but some have exactly the same one.

Game of Life: "Couldn't find pdz file main.pdz"
3D Library: "knot.lua:110: attempt to index a nil value (global 'lib3d') ..."
hello_world: "File not found."
Array: "File not found."
Bach: "File not found."

I am using the most recent version of the SDK which is 2.4.2.

I tried tweaking pdxinfo, cmake and make files hoping this is some sort of mismatch between the names but no luck.

I don't really know how to approach this problem as everything seems to be working perfectly fine on the simulator and it's only happening on the device and it doesn't seem I can get any more info from the device itself.

Oh, and just to make this clear, the device itself is also using latest Playdate OS version 2.4.2.

Does anyone what is causing this issue?


Okay, so, I managed to run my example on the device using "Upload Game to Device...". This is interesting cause it wasn't working at all in the beginning. I am still getting the crash when I just select "Run Game on Device..." though. Something is not quite right here.

Okay, I've made few changes to my main.c file and now I am getting a crash again. This time with a "Couldn't find pdz file main.pdz" message. I am getting more and more confused...

Have you made sure you're building specifically for the device? There should be a file called pdex.bin in the source directory if so. That's what the device is looking for. If it isn't found it'll assume the game is written in Lua and try to load main.pdz.

How do I make sure I build specifically for the device on Windows? I thought building in via Visual Studio, running in Simulator and uploading to the device using the simulator would be enough. What step am I missing?

Okay so I think I finally figured it out. The issue was indeed the fact that I need to explicitly run this extra commands:
cmake .. -G "NMake Makefiles" --toolchain=<path to SDK>/C_API/buildsupport/arm.cmake
and then:

I had some strange compilation errors but I found another thread mentioning you cannot use a lot of stuff from the C library like asset and others which I did. Once I removed dependencies from the C library it compiled and once the game was uploaded to the device it is working just fine.

Thanks for the help @scratchminer!