Libburn
所以,在我安装了libburn之后,我转到了与libburn代码一起提供的测试文件夹。然后是libburner.c文件。我试图用gcc(gcc-libburn.c-o outputfile(编译它,但即使头文件存在,它也会给我这些错误。
libburner.c:(.text+0xb17): undefined reference to `burn_disc_create'
/usr/bin/ld: libburner.c:(.text+0xb20): undefined reference to `burn_session_create'
/usr/bin/ld: libburner.c:(.text+0xb3c): undefined reference to `burn_disc_add_session'
/usr/bin/ld: libburner.c:(.text+0xb4d): undefined reference to `burn_track_create'
/usr/bin/ld: libburner.c:(.text+0xb84): undefined reference to `burn_track_define_data'
/usr/bin/ld: libburner.c:(.text+0xc4d): undefined reference to `burn_fd_source_new'
/usr/bin/ld: libburner.c:(.text+0xcd1): undefined reference to `burn_fifo_source_new'
/usr/bin/ld: libburner.c:(.text+0xd39): undefined reference to `burn_track_set_source'
/usr/bin/ld: libburner.c:(.text+0xd81): undefined reference to `burn_session_add_track'
/usr/bin/ld: libburner.c:(.text+0xdad): undefined reference to `burn_source_free'
/usr/bin/ld: libburner.c:(.text+0xdd7): undefined reference to `burn_disc_get_status'
/usr/bin/ld: libburner.c:(.text+0xe23): undefined reference to `burn_disc_erasable'
/usr/bin/ld: libburner.c:(.text+0xeac): undefined reference to `burn_write_opts_new'
/usr/bin/ld: libburner.c:(.text+0xec1): undefined reference to `burn_write_opts_set_perform_opc'
/usr/bin/ld: libburner.c:(.text+0xedc): undefined reference to `burn_write_opts_set_multi'
/usr/bin/ld: libburner.c:(.text+0xf05): undefined reference to `burn_write_opts_set_simulate'
/usr/bin/ld: libburner.c:(.text+0xf1e): undefined reference to `burn_drive_set_speed'
/usr/bin/ld: libburner.c:(.text+0xf2f): undefined reference to `burn_write_opts_set_underrun_proof'
/usr/bin/ld: libburner.c:(.text+0xf4b): undefined reference to `burn_write_opts_auto_write_type'
/usr/bin/ld: libburner.c:(.text+0xfb4): undefined reference to `burn_set_signal_handling'
/usr/bin/ld: libburner.c:(.text+0xfe1): undefined reference to `burn_disc_write'
/usr/bin/ld: libburner.c:(.text+0x1001): undefined reference to `burn_drive_get_status'
/usr/bin/ld: libburner.c:(.text+0x1114): undefined reference to `burn_fifo_inquire_status'
/usr/bin/ld: libburner.c:(.text+0x119d): undefined reference to `burn_drive_get_status'
/usr/bin/ld: libburner.c:(.text+0x11b9): undefined reference to `burn_is_aborting'
/usr/bin/ld: libburner.c:(.text+0x1236): undefined reference to `burn_write_opts_free'
/usr/bin/ld: libburner.c:(.text+0x1266): undefined reference to `burn_source_free'
/usr/bin/ld: libburner.c:(.text+0x128d): undefined reference to `burn_track_free'
/usr/bin/ld: libburner.c:(.text+0x12af): undefined reference to `burn_source_free'
/usr/bin/ld: libburner.c:(.text+0x12c2): undefined reference to `burn_session_free'
/usr/bin/ld: libburner.c:(.text+0x12d5): undefined reference to `burn_disc_free'
/usr/bin/ld: /tmp/cchZ1bZA.o: in function `main':
libburner.c:(.text+0x1a52): undefined reference to `burn_initialize'
/usr/bin/ld: libburner.c:(.text+0x1a7c): undefined reference to `burn_msgs_set_severities'
/usr/bin/ld: libburner.c:(.text+0x1a92): undefined reference to `burn_set_signal_handling'
/usr/bin/ld: libburner.c:(.text+0x1c6e): undefined reference to `burn_drive_release'
/usr/bin/ld: libburner.c:(.text+0x1c7b): undefined reference to `burn_is_aborting'
/usr/bin/ld: libburner.c:(.text+0x1c8d): undefined reference to `burn_abort_pacifier'
/usr/bin/ld: libburner.c:(.text+0x1c9a): undefined reference to `burn_abort'
/usr/bin/ld: libburner.c:(.text+0x1cc9): undefined reference to `burn_finish'
collect2: error: ld returned 1 exit status
请帮帮我。
在C:中创建软件时,通常会涉及到三种工具
- 一个编辑器来编写源代码
- 一个编译器,用于将源代码转换为目标代码,目标代码主要由机器代码组成,其引用尚未解析
- 链接器,用于将目标代码的分离部分链接(绑定(到可执行文件中,该可执行文件已解析所有引用
您可以将任何应用程序用作编辑器,以创建正确格式的源代码。我甚至听说有人用微软Word做这个,因为当时的记事本无法处理大于64KB的文件。
您显然将GCC用作编译器和链接器。
你没有提到任何编译问题,它显然没有报告任何错误。无论如何,测试应用程序的源代码包含行#include "libburn.h"
或类似内容。通过这种方式,编译器知道应用程序可以调用某些函数,并且可以检查应用程序是否以正确的方式不调用这些函数。
您写道要构建的命令行是gcc libburn.c -o outputfile
,我认为这是错误的。应该是gcc libburner.c -o outputfile
。
此命令行缺少指向库libburn
的链接的参数。因此,链接器报告了许多"未定义的引用"。
将-lburn
添加到命令行,或者添加其他合适的内容。您也没有提到构建的主机和目标系统,这取决于具体情况。
注意:命令行同时包含两个步骤:编译和链接。请花一些时间研究并学习如何从命令行使用GCC