导入错误:[libraryname].so:未定义符号:[function name]

6 投票
1 回答
3452 浏览
提问于 2025-04-16 01:04

我正在用一个C模块扩展我的Python程序,这个C模块使用了GStreamer的GstPhotography接口。我的C模块编译得很好,但当我从Python运行它时,出现了这个错误:

$python Program.py
Traceback (most recent call last):
   File "Program.py", line 10, in <module>
     import MyPythonClass
   File "/path/MyPythonClass.py", line 19, in <module>
     import my_c_module
ImportError: /path/my_c_module.so: undefined symbol: gst_photography_get_type  

我不太明白这是什么意思,因为我在my_c_module.cpp里根本没有使用过gst_photography_get_type这个函数——这个函数是在GstPhotography的源代码里实现的。

1 个回答

0

这句话的意思是,你没有链接足够的库文件。这可能是因为在pkgconfig文件中没有说明需要哪些库,或者你根本就没有使用这个pkgconfig文件。

撰写回答