Skip to content

Some code in the "common" libraries is incompatible with MSVC #435

Open

Description

@jonathangjertsen

I encountered some issues while trying to build parts of the pico sdk for MSVC (for host-based unit testing):

  • using the invalid_params_if, valid_params_if, hard_assert_if macros triggers errors like [...]\pico-sdk\src\host\hardware_timer\include\hardware/timer.h(22): error C2059: syntax error: '{'
  • auto_init_mutex uses __attribute__ which is a GCC extension
  • sem_available uses typeof which is a GCC extension
  • hw_divider_result_threadlocal is declared with __thread, but platform.h (which defines __thread) is not included by the header file

I have workarounds for these issues in jonathangjertsen@0fa7da9, but they are hacks and only cover the parts I used in my application. A quick search through the code base reveals many other usages of GCC extensions under the "common" code.

To what extent is building for host with MSVC supported? It seems like at least some support was intended at some point, since there are a couple of checks for _MSC_VER.

Activity

  1. kilograham commented on May 23, 2021

    @kilograham
    Contributor

    Yeah it isn't really supported atm as (as you saw) started down that route, but there are a bunch of (as you say non-trivial) issues; hoping that gcc is a reasonable workaround on WIndows, but happy to accept PRs to fix either, we just don't have any resources to spend on it atm.

  2. modified the milestones: 1.3.0, none on May 31, 2021
  3. ajf58 commented on Jan 19, 2025

    @ajf58
    Contributor

    This is still an issue with v2.1.0.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions