You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When compiling a C extension using setuptools, despite setting language="c++" and extra_compile_args=["/TP"] in the setup.py file, MSVC still compiles the file as C, using the /Tcmyext.c option instead of compiling it as C++.
Actual Behavior:
The compilation command still uses /Tcmyext.c and compiles the file as C instead of C++.
Expected behavior
MSVC should compile the myext.c file as C++ according to the /TP option and language="c++" setting.
fromsetuptoolsimportsetup, Extensionmodule=Extension(
"myext",
sources=["myext.c"], # C fileextra_compile_args=["/TP"], # Force C++ compilationlanguage="c++"# Specify language as C++
)
setup(
name="MyExtension",
ext_modules=[module],
)
setuptools version
75.8.0
Python version
3.12
OS
Windows11
Additional environment information
VS2022
Description
When compiling a C extension using setuptools, despite setting language="c++" and extra_compile_args=["/TP"] in the setup.py file, MSVC still compiles the file as C, using the /Tcmyext.c option instead of compiling it as C++.
Actual Behavior:
The compilation command still uses
/Tcmyext.c
and compiles the file as C instead of C++.Expected behavior
MSVC should compile the myext.c file as C++ according to the
/TP
option and language="c++" setting.How to Reproduce
myext.c
setup.py
Run the compilation command:
Output
The text was updated successfully, but these errors were encountered: