wlav / cppyy

Other
391 stars 40 forks source link

Multiple errors in corecrt.h on import of cppyy #130

Closed Daddelhai closed 1 year ago

Daddelhai commented 1 year ago

System

Windows 10 Pro 21H2 (19044.2604) Visual Studio Build Tools 2022

Python

Tried with

Pip List

Package Version
aiohttp 3.8.4
aiosignal 1.3.1
anyio 3.6.2
async-timeout 4.0.2
attrs 22.2.0
certifi 2022.12.7
charset-normalizer 3.0.1
click 8.1.3
colorama 0.4.6
fastapi 0.92.0
frozenlist 1.3.3
h11 0.14.0
httptools 0.5.0
idna 3.4
multidict 6.0.4
numpy 1.24.2
pip 23.0.1
pydantic 1.10.5
pygame 2.1.3
python-dotenv 0.21.1
PyYAML 6.0
requests 2.28.2
setuptools 65.5.0
sniffio 1.3.0
starlette 0.25.0
typing_extensions 4.5.0
urllib3 1.26.14
uvicorn 0.20.0
watchfiles 0.18.1
websockets 10.4
wheel 0.38.4
yarl 1.8.2

Programm

import cppyy

cppyy.cppdef('''
void hello() {
    std::cout << "Hello, World!" << std::endl;
}''')

cppyy.gbl.hello()

Console Output

(venv) PS D:\Programmierung\Python\ATCSim\tests> & d:/Programmierung/Python/ATCSim/venv/Scripts/python.exe d:/Programmierung/Python/ATCSim/tests/cppyy_test.py
In file included from input_line_3:38:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include\cassert:9:
In file included from C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\assert.h:12:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\corecrt.h:260:12: error: redefinition of '_CrtEnableIf<true, _Ty>'
    struct _CrtEnableIf<true, _Ty>
           ^~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt.h:205:12: note: previous definition is here
    struct _CrtEnableIf<true, _Ty>
           ^
In file included from input_line_3:38:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include\cassert:9:
In file included from C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\assert.h:12:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\corecrt.h:610:16: error: redefinition of '__crt_locale_data_public'
typedef struct __crt_locale_data_public
               ^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt.h:596:16: note: previous definition is here
typedef struct __crt_locale_data_public
               ^
In file included from input_line_3:38:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include\cassert:9:
In file included from C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\assert.h:12:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\corecrt.h:617:16: error: redefinition of '__crt_locale_pointers'
typedef struct __crt_locale_pointers
               ^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt.h:603:16: note: previous definition is here
typedef struct __crt_locale_pointers
               ^
In file included from input_line_3:38:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include\cassert:9:
In file included from C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\assert.h:12:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\corecrt.h:625:16: error: redefinition of '_Mbstatet'
typedef struct _Mbstatet
               ^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt.h:611:16: note: previous definition is here
typedef struct _Mbstatet
               ^
Hello, World!

Expected Behavior

Just a "Hello, World" in the console...

wlav commented 1 year ago

This is known: Clang9 can not parse the standard C++ headers of MSVC 2022, as Clang10 is the minimum they support. Master repo has cppyy at Clang13. I'm one issue away from releasing.

wlav commented 1 year ago

cppyy 3.0.0, based on Clang13, was released yesterday and should work fine with MSVC 2022.