How to pass c++ standard version to cythonize command

76 views
Skip to first unread message

Joth

unread,
Aug 1, 2024, 1:03:08 PM8/1/24
to cython-users
Hello,

I want to use std::optional in cython but when I build my cpp file with cythonize command I get build error because the MSVC compiler takes C++14 by default:
The contents of <optional> are available only with C++17 or later.

How can I pass the c++ standard version to cythonize command ?


da-woods

unread,
Aug 1, 2024, 1:18:16 PM8/1/24
to cython...@googlegroups.com
The easiest way is to use a comment in the source file giving extra arguments to the C++ compiler

# distutils: extra_compile_args =  /std:c++17

Just put that at the top of your source file.
--

---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cython-users/cb53f2a8-f836-47bd-b82b-4d71013535c3n%40googlegroups.com.


Reply all
Reply to author
Forward
0 new messages