Skip to content

Static assertion in numpy.h fails when compiling with MINGW GCC #1342

@lvk88

Description

@lvk88

When compiling this code:

#include "pybind11/pybind11.h"
#include "pybind11/numpy.h"

namespace py=pybind11;

PYBIND11_MODULE(foo,m)
{

}

With mingw GCC 6.3.0 64bit (default flags provided by cmake), I am getting the following error message:

In file included from pybind.cpp:2:0:
C:\{whatever_path_to_my_pybind_includes}/pybind11/numpy.h:35:1: error: static assertion failed: ssize_t != Py_intptr_t
 static_assert(sizeof(ssize_t) == sizeof(Py_intptr_t), "ssize_t != Py_intptr_t");
 ^~~~~~~~~~~~~

To get rid of it, I need to manually add -DMS_WIN64 to the compiler flags. Also, -D_hypot=hypot needs to be added, but this is related to issue #838 .

Is this something that someone might have encountered before?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions