سؤال

I'm trying to use boost.python and build a python extension from c++.

My cpp file use a function named 'BZ2_bzopen' which is in the library 'libbz2' under standard path (/usr/lib/). However, when I try to build the extension using boost build following the instruction, I received an error said:

====== BEGIN OUTPUT ======
Traceback (most recent call last):
  File "CrossTrade.py", line 11, in <module>
    from custom_c import GoThroughFile
ImportError: /home/jliu/toolpak/custom_c.so: undefined symbol: BZ2_bzopen

EXIT STATUS: 1
====== END OUTPUT ======

This seems to me as an error comes from not linking to the library, which is almost the same as if I compile the cpp file without the '-lbz2' command.

Anyone could offer some help on solving it, please?

هل كانت مفيدة؟

المحلول

Maybe you did not link to libbz2? In that case, follow the instructions in http://www.boost.org/doc/libs/1_46_1/doc/html/bbv2/tutorial.html#bbv2.tutorial.prebuilt to see how to link to libraries.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top