I'm encountering syntax errors related to the Playdate SDK when building a project using Visual Studio and CMake on Windows. Specifically, I'm getting errors related to missing or improperly defined types such as LCDColor
, LCDBitmapFlip
, and PDStringEncoding
in pd_api_gfx.h
. Additionally, Visual Studio is reporting that the PDSystemEvent
type is undefined. The build stops with over 100 errors, many of which are syntax-related, indicating that the compiler does not recognize the SDK types correctly.
Here’s an example of some of the errors I’m encountering:
${PLAYDATE_SDK_PATH}/C_API/pd_api_gfx.h(127): error C2146: syntax error: missing ')' before identifier 'color'
${PLAYDATE_SDK_PATH}/C_API/pd_api_gfx.h(127): error C2061: syntax error: identifier 'color'
${PLAYDATE_SDK_PATH}/C_API/pd_api_gfx.h(140): error C2081: 'LCDBitmapFlip': name in formal parameter list illegal
${PLAYDATE_SDK_PATH}/C_API/pd_api_gfx.h(152): error C2081: 'LCDColor': name in formal parameter list illegal
Additionally, the IDE highlights the PDSystemEvent
type as undefined in the code:
What I've Tried So Far:
- Verified that
pd_api.h
is included correctly inmain.c
. - Ensured that the
PLAYDATE_SDK_PATH
environment variable is set and included inCMakeLists.txt
. - Added MSVC-specific compile options to suppress warnings and ensure compatibility.
- Tested with the C11 standard enabled using
set(CMAKE_C_STANDARD 11)
. - Checked that the types like
LCDColor
andLCDBitmapFlip
are defined inpd_api_gfx.h
, and they seem to be present.
Despite these efforts, the errors persist, particularly when using the MSVC compiler in Visual Studio. I suspect there might be an issue with how MSVC handles the SDK’s headers, but I’m unsure how to resolve it.
Has anyone experienced similar issues when working with the Playdate SDK on Windows using Visual Studio? Any help would be greatly appreciated!