So after I installed libburn I went to the test folder which comes with the libburn's code.Then there is the libburner.c file.I try to compile it with gcc(gcc libburn.c -o outputfile) but it gives me these error even though the header file exists.
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
Please help me.
Commonly and in short terms there are three tools involved when you create software in C:
You can use any application as an editor that can create source code in the right format. I even heard about a guy using Microsoft Word for this, because the Notepad of that time could not handle files larger than 64 KB.
You use GCC apparently as compiler and linker.
You didn't mention any compilation problem, it apparently reported no errors. Anyway, the source code of the test application contains the line #include "libburn.h"
or similar. This way the compiler knows that there are functions the application can call, and it can check that the application calls none or more of these functions in the right way.
You wrote that your command line to build is gcc libburn.c -o outputfile
, which I think is wrong. It should be gcc libburner.c -o outputfile
.
This command line is missing the argument to link against the library libburn
. Consequently the linker reports a lot of "undefined references".
Add -lburn
to the command line, or what else is appropriate. You didn't mention the host and target system of your build, too, and it depends.
Note: The command line contains both steps in one: compiling and linking. Please take some minutes to research and to learn how to use GCC from the command line.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments