Keith Sloan
Keith Sloan

Reputation: 55

import of python module which is in C++ compiled with gcc 4.4.3

I am trying to develop a C++ module that is called from Python.

I have written a test case, but when I try and tun the python the import fails with

Traceback (most recent call last):
File "testHull.py", line 1, in <module>
import CallGCAL

ImportError: /usr/lib/freecad/Mod/OpenSCAD/GCAL/CallGCAL.so:
undefined symbol: _ZNSt8ios_base4InitD1Ev

The C complier used to compile the C++ module was gcc 4.4.3.

From googling round I get the impression there is an imcompatibilty between the version of Gcc I am using and the one used to compile python which is 2.6, but don't know how to proceed.

I know python 2.6 is old, but I am trying to get something running in FreeCAD 0.13 which only supports Python 2.6

Upvotes: 0

Views: 406

Answers (1)

Adam
Adam

Reputation: 17339

Use the g++ command to compile C++ code, not gcc.

g++ is still GCC, but it's in C++ mode so it will link to the standard C++ library.

The undefined symbol is:

$ c++filt -n _ZNSt8ios_base4InitD1Ev
std::ios_base::Init::~Init()

In other words, the standard library has not been linked.

Upvotes: 2

Related Questions