C template / setup on Windows 2023

I'd like to give it a try to develop for the playdate with C. But being a C noob, I struggle with even getting a basic hello world in main.c running (..PlaydateSDK\C_API\Examples\Hello World)

I've followed along the documentation and gave it a try with Clion:

But clion doesn't seem to know the "platform", I've got the error:
CMake Error at C:/Users/haas/Documents/PlaydateSDK/C_API/buildsupport/playdate_game.cmake:68 (message):
Platform not supported!
And I could solved the last part with adding the path to the simulator, I didn't understand where to add it.

I could run the cmake to build without errors throught the "x64 Native Tools Command Prompt for VS 2019" and open it with the visual studio 2019:

When opened in visual studio and trying to run it (default run config: Debug, x64 and "local windows debugger") I'm getting an access denied error.

Do I need to create a run config for the playdate simluator?

I've had a look at the old thread:

At the end says, one should use the Inside Playdate with C for setup. But I lack the pre-required knowledge.

So yeah, it would be great to have a beginner friendly guide to setup the playdate to code with C (on Windows).

Also here are some templates (which I couldn't get any to run :slight_smile: ):

CMake + CLion on Windows isn't officially supported at the moment, however you probably could get it working with a bit of work. What complier do you have CLion pointing at? If you are getting a platform not supported error from the CMake file it's not using MSVC to compile so the correct flags aren't be set from CLion when running the CMake file. Unfortunately I don't know CLion so I'm not much help when it comes to configuring it.

As for Visual Studio 2019, that should work without issue. Where did you install the SDK? Are you running as an Admin user? Without the exact error code it's hard to debug it from here, but I'd suggest googling around a bit for the error. My guess is you'll find someone with the same issue.

The Debug and Release configs already have the Simulator targeted, there is no need for additional configuring.

I personally haven't used any of these C GitHub projects so I'm not sure what sort of state they are in. I'd stick with getting the examples working first with the steps listed in Inside Playdate with C, then start looking at other people's projects.

The sdk_path is set correctly.
Okay, about the Visual Studio 2019. If I load up the generated project from the build folder, should the run config say something like "playdate simulator"?

Because it just says "local windows debuger" ... how to I link it with the playdate simulator?

Local Windows Debugger is correct. You'll be doing your debugging in Visual Studio, not the Simulator. The example projects are set up to launch and run the built game the Simulator and debug it in VS.

That said, in the Solutions Explorer make sure "hello_world" (or whatever your project is called) is "Set as Startup Project" using the right-click menu. Then when you click the "Local Windows Debugger" button it will launch the Simulator and automatically start debugging the current source code.

I hope that helps a bit.

1 Like