Skip to content

Conversation

@ZHBHFUT
Copy link
Contributor

@ZHBHFUT ZHBHFUT commented Oct 9, 2025

Fix MSVC-specific syntax issues

Proposed changes:

  1. noreturn Function Declarations

    • Modified noreturn function declarations to be compatible with MSVC compiler
    • Added platform-specific macros for proper cross-compilation support
  2. printf-style Format String Validation

    • Improved format string checking for printf-style functions
    • Added MSVC-compatible format specifiers where needed
  3. Improved aligned memory allocation and free

    • Use _aligned_malloc, _aligned_free, and _aligned_realloc on Windows.​​
  4. Windows Sleep Implementation

    • Added macro definitions in pthread.c for sleep functionality
    • Implemented Windows platform support using Sleep() API

These changes enable successful compilation on Windows using MSVC without requiring MinGW or clang-cl toolchains, while maintaining compatibility with other platforms.

Windows Build Instructions

To compile on Windows with MSVC:

  1. Generate VS solution using CMake:
cmake -G "Visual Studio 17 2022" -A x64
  1. Open the generated solution in Visual Studio and add code before the defination of struct sc_camera in sc_camera.h (cburstedde said this will be fiexd in the future 😄):
#ifdef near
#undef near
#endif
#ifdef far
#undef far
#endif
  1. Build as normal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant