From a .pyx file create .cpp file and not a .c file

Viewed 168

I am new to cython. I have a project file project_file.pyx which I would like to manually create a .cpp file with.

I have tried cython project_file.pyx but this produces project_file .c. However I would like to produce the file project_file.cpp.

How can I do this? I'm running a Linux environment.

2 Answers

You should put this line at the top of your .pyx file:

# distutils: language = c++

This should compile it in to a .cpp file.

Use the --cplus flag.

cython --cplus project_file.pyx

Related