Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7571693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:44:03+00:00 2026-05-30T15:44:03+00:00

I am working on a project where I want to use a C++ library

  • 0

I am working on a project where I want to use a C++ library in Python. After a little bit of research I figured out that Swig would be a good way to do it (a small example worked).

So now I am trying to include Swig into cmake to make things more comfortable.

In my case, I have a really small program to test things:

#include "ct.h"
using namespace std;

int main(int argc, char const *argv[])
{
    /* code */
    return 0;
}

int test()
{
    Image image(10,11);
    cout << "hallo"<< endl;

    return 3;
}

The Image class is defined in a header “image.h”, which is included in “ct.h”. This is probably the problem here, since the library, which includes the Image class needs to be linked against the library, which is generated by Swig.
I am not sure about this…And, especially, I don’t know how to do this. I was not able to find anything in the manual.

Anyway, if I want to include the lib in python I get the following error:

>>> import kissCT
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "kissCT.py", line 25, in <module>
    _kissCT = swig_import_helper()
  File "kissCT.py", line 21, in swig_import_helper
    _mod = imp.load_module('_kissCT', fp, pathname, description)
ImportError: ./_kissCT.so: undefined symbol: _ZN5ImageC1Eii

The related Swig file looks like this:

/* kissCT test module */

%module kissCT
%{
#import "ct.h"
extern int test();
%}
extern int test();

I hope, all this is not to confusing and I would really appreciate if someone has an idea what I did wrong.

Edit: the related cmake file looks like this

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T15:44:04+00:00Added an answer on May 30, 2026 at 3:44 pm

    Python needs to be able to find the image library at run time. The simplest way is to set LD_LIBRARY_PATH environment variable to the folder containing the image .so file which contains the undefined symbol.

    If you run the command “ldd _kissCT.so” it should show you the libraries it depends on.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a working Android tuner project app that I want to use as
I'm working on a new project where I want to use Phil Haack Areas
I am working on a project that I want to implement AJAX, and I
Hey so I have been working on a project that I want to be
I am working on a project and want to optionally use an assembly if
I'm working on a project where we want to use checked exceptions to notify
I am working on an iPhone project and want to use an open source
I'm working on a source-code visualization project that uses the Processing core library. The
I'm working on a project and I want to store some easily enumerated information
I'm working on a project which I want to build up OO. Now I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.