I'm trying to translate some simple cython to c++ :
cdef public int G = 1
and then use it in my c++ code :
#include <Python.h>
#include "test.h" // The file generated by the cython command
#include <iostream>
int main(int argc, char **argv) {
std::cout << "G : " << G << std::endl;
}
Output is :
G : 0
I've looked into the test.cpp
cython-generated file, and on line 897, I have
G = 1;
So why is G evaluated to 0 in the main
?
Here are the commands used to compile :
cython.exe test.pyx -3 --cplus
g++ test.cpp test_main.cpp -IC:\Python36-32\include -LC:\Python36-32\libs -lpython36