Odomontois
Odomontois

Reputation: 16318

cython c++ undefined reference to std::ios_base::failure

I just wrote cython code just as simple as that

# distutils: language = c++

from libcpp.map cimport map,pair
from ios import *



cdef map[int,int] * u = new map[int,int]()

cdef add_item(int n, int x):
    cdef pair[int,int]p = pair[int,int](n,x)
    u.insert(p)

def add(int n, int x):
    add_item(n,x)

added build file like

def make_ext(modname, pyxfilename):
    from distutils.extension import Extension
    return Extension(name=modname,
                     sources=[pyxfilename],
                     language='C++')

and run simple script like

import hello

with lines

import pyximport pyximport.install()

in my sitecustomize.py

At script execution i get ImportError: Building module hello failed: ['ImportError: /home/odomontois/.pyxbld/lib.linux-x86_64-2.7/hello.so: undefined symbol: _ZTINSt8ios_base7failureE\n']

c++filt _ZTINSt8ios_base7failureE prints typeinfo for std::ios_base::failure

Is there any possibility to find out what object file i should include and how to do this in my pyxbld file for example.

Upvotes: 2

Views: 660

Answers (1)

Odomontois
Odomontois

Reputation: 16318

Resolved by adding

libraries=["stdc++"]

to pyxbld

Upvotes: 2

Related Questions