ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 04 Mar 2013 20:41:35 -0600c++ cython in the notebookhttp://ask.sagemath.org/question/9819/c-cython-in-the-notebook/I recently wanted to cimport sage.rings.number_field.number_field_element_quadratic from the a cython cell in notebook, but was met with gcc compilation errors. This is because that file is a c++ module.
So I am wondering, is there is a way to use the c++ functionality of cython from within a notebook cell?Wed, 27 Feb 2013 11:34:01 -0600http://ask.sagemath.org/question/9819/c-cython-in-the-notebook/Comment by benjaminfjones for <p>I recently wanted to cimport sage.rings.number_field.number_field_element_quadratic from the a cython cell in notebook, but was met with gcc compilation errors. This is because that file is a c++ module. </p>
<p>So I am wondering, is there is a way to use the c++ functionality of cython from within a notebook cell?</p>
http://ask.sagemath.org/question/9819/c-cython-in-the-notebook/?comment=18135#post-id-181351) How did you install Sage? (compiling from source, downloading a binary, on a notebook server)
2) Do you have a c++ compiler installed on your system?Wed, 27 Feb 2013 16:03:05 -0600http://ask.sagemath.org/question/9819/c-cython-in-the-notebook/?comment=18135#post-id-18135Comment by ohanar for <p>I recently wanted to cimport sage.rings.number_field.number_field_element_quadratic from the a cython cell in notebook, but was met with gcc compilation errors. This is because that file is a c++ module. </p>
<p>So I am wondering, is there is a way to use the c++ functionality of cython from within a notebook cell?</p>
http://ask.sagemath.org/question/9819/c-cython-in-the-notebook/?comment=18110#post-id-18110Compiled from source (which implies that I have a c++ compiler), I just never really use the notebook interface.Mon, 04 Mar 2013 20:41:35 -0600http://ask.sagemath.org/question/9819/c-cython-in-the-notebook/?comment=18110#post-id-18110Answer by Bétréma for <p>I recently wanted to cimport sage.rings.number_field.number_field_element_quadratic from the a cython cell in notebook, but was met with gcc compilation errors. This is because that file is a c++ module. </p>
<p>So I am wondering, is there is a way to use the c++ functionality of cython from within a notebook cell?</p>
http://ask.sagemath.org/question/9819/c-cython-in-the-notebook/?answer=14610#post-id-14610On my installation, in a notebook cell:
%cython
cimport sage.rings.number_field.number_field_element_quadratic
yields
[...]code_sage4_spyx_0.c:644:14: error: field __pyx___numerator has incomplete type
[...]code_sage4_spyx_0.c:645:13: error: field __pyx___denominator has incomplete type
[...]code_sage4_spyx_0.c:1090:13: error: field x has incomplete type
[...]code_sage4_spyx_0.c:1356:14: error: field x has incomplete type
error: command 'gcc' failed with exit status 1
but adding the *magic comment* below (see http://wiki.sagemath.org/faq) makes gcc quite happy:
%cython
#clang c++
cimport sage.rings.number_field.number_field_element_quadratic
Thu, 28 Feb 2013 02:21:01 -0600http://ask.sagemath.org/question/9819/c-cython-in-the-notebook/?answer=14610#post-id-14610