When building C++ extensions for Python, you can specify the version of the C++ standard to use by setting the CXX
environment variable before running the setup.py
script.
For example, to specify that you want to use the C++11 standard, you can set the CXX
environment variable to g++
with the -std=c++11
flag:
CXX=g++-7 -std=c++11 python setup.py build_ext --inplace
In this example, we are setting the CXX
environment variable to g++-7
, which is the GNU C++ compiler version 7. We are also specifying the -std=c++11
flag to indicate that we want to use the C++11 standard.
You can replace g++-7
with the path to your C++ compiler and -std=c++11
with the C++ standard you want to use.
Note that the C++ standard you use may depend on the specific requirements of your C++ code and the libraries you are using. You should consult the documentation for your C++ libraries and make sure that the C++ standard you choose is compatible with the libraries you are using.
+ There are no comments
Add yours