ld finds library when run stand along but cant find when building executable - linker

I am trying to build a program that requires the linking of libndctl. However, ld fails to find the library, and the build errors out at the linking stage stating (this used to build without error some time before):
Command:
g++ tatp_db.cc tatp_nvm.cc ../include/txopt.cc -lpmem -lpthread -o tatp_nvm -std=c++11 -static
Error:
/usr/bin/ld: /usr/local/lib/libpmem.a(libpmem_all.o): in function `pmem2_device_dax_alignment':
memset_t_avx512f.c:(.text+0xb527): undefined reference to `ndctl_new'
/usr/bin/ld: memset_t_avx512f.c:(.text+0xb59e): undefined reference to `ndctl_namespace_get_dax'
/usr/bin/ld: memset_t_avx512f.c:(.text+0xb5b5): undefined reference to `ndctl_dax_get_align'
/usr/bin/ld: memset_t_avx512f.c:(.text+0xb5ce): undefined reference to `ndctl_unref'
/usr/bin/ld: /usr/local/lib/libpmem.a(libpmem_all.o): in function `pmem2_device_dax_size':
memset_t_avx512f.c:(.text+0xb62f): undefined reference to `ndctl_new'
/usr/bin/ld: memset_t_avx512f.c:(.text+0xb6a9): undefined reference to `ndctl_namespace_get_dax'
/usr/bin/ld: memset_t_avx512f.c:(.text+0xb6c0): undefined reference to `ndctl_dax_get_size'
/usr/bin/ld: memset_t_avx512f.c:(.text+0xb700): undefined reference to `ndctl_unref'
/usr/bin/ld: /usr/local/lib/libpmem.a(libpmem_all.o): in function `pmem2_region_namespace':
memset_t_avx512f.c:(.text+0xc3ab): undefined reference to `ndctl_bus_get_first'
/usr/bin/ld: memset_t_avx512f.c:(.text+0xc3c0): undefined reference to `ndctl_region_get_first'
/usr/bin/ld: memset_t_avx512f.c:(.text+0xc3d5): undefined reference to `ndctl_namespace_get_first'
/usr/bin/ld: memset_t_avx512f.c:(.text+0xc3f2): undefined reference to `ndctl_namespace_get_dax'
/usr/bin/ld: memset_t_avx512f.c:(.text+0xc41e): undefined reference to `ndctl_dax_get_daxctl_region'
/usr/bin/ld: memset_t_avx512f.c:(.text+0xc463): undefined reference to `daxctl_dev_get_first'
/usr/bin/ld: memset_t_avx512f.c:(.text+0xc475): undefined reference to `daxctl_dev_get_devname'
/usr/bin/ld: memset_t_avx512f.c:(.text+0xc4e1): undefined reference to `daxctl_dev_get_next'
/usr/bin/ld: memset_t_avx512f.c:(.text+0xc512): undefined reference to `ndctl_namespace_get_btt'
/usr/bin/ld: memset_t_avx512f.c:(.text+0xc529): undefined reference to `ndctl_btt_get_block_device'
/usr/bin/ld: memset_t_avx512f.c:(.text+0xc53b): undefined reference to `ndctl_namespace_get_pfn'
/usr/bin/ld: memset_t_avx512f.c:(.text+0xc552): undefined reference to `ndctl_pfn_get_block_device'
/usr/bin/ld: memset_t_avx512f.c:(.text+0xc564): undefined reference to `ndctl_namespace_get_block_device'
/usr/bin/ld: memset_t_avx512f.c:(.text+0xc5d1): undefined reference to `ndctl_namespace_get_next'
/usr/bin/ld: memset_t_avx512f.c:(.text+0xc5ec): undefined reference to `ndctl_region_get_next'
/usr/bin/ld: memset_t_avx512f.c:(.text+0xc607): undefined reference to `ndctl_bus_get_next'
/usr/bin/ld: /usr/local/lib/libpmem.a(libpmem_all.o): in function `pmem2_get_region_id':
memset_t_avx512f.c:(.text+0xc64f): undefined reference to `ndctl_new'
/usr/bin/ld: memset_t_avx512f.c:(.text+0xc6f8): undefined reference to `ndctl_region_get_id'
/usr/bin/ld: memset_t_avx512f.c:(.text+0xc70a): undefined reference to `ndctl_unref'
collect2: error: ld returned 1 exit status
make: *** [Makefile:9: all] Error 1
I tried fixing this by manually adding -lndctl to the build command
g++ tatp_db.cc tatp_nvm.cc ../include/txopt.cc -lpmem -lpthread -lndctl -o tatp_nvm -std=c++11 -static
Error:
/usr/bin/ld: cannot find -lndctl
collect2: error: ld returned 1 exit status
make: *** [Makefile:9: all] Error 1
I see that the library exists in /usr/lib/ and when running ld stand-alone (/usr/bin/ld -lndctl --verbose) it finds the library. Does anyone know what causes this to happen and a fix?

Command:
g++ tatp_db.cc tatp_nvm.cc ../include/txopt.cc -lpmem -lpthread -o tatp_nvm -std=c++11 -static
That command is wrong: you said yourself that this binary requires libndtcl, yet you aren't listing that library on the command line, so of course its symbols end up being unresolved.
I tried fixing this by manually adding -lndctl to the build command
That is the correct fix.
/usr/bin/ld: cannot find -lndctl
I see that the library exists in /usr/lib/
There are a few likely root causes:
If you are linking a 64-bit executable (which seems likely), /usr/lib/libndctl* may exist, but is a 32-bit binary.
You need a 64-bit version (usually found in /usr/lib64) and that version is not present.
You have only libndctl.so*, but not libndtcl.a (the latter is required for -static link).
To fix, you would need to install libndctl-dev or similar package.

Related

How do I link to the locally installed librdkafka in my own projects CMake?

I have installed rdkafka locally on my machine via the apt package manager as instructed in their documentation. Now I want to link to that library with CMake so I can use it.
I am currently trying it like this:
find_package(PkgConfig REQUIRED)
pkg_check_modules(rdkafka REQUIRED rdkafka)
target_include_directories(myTarget PUBLIC ${RDKAFKA_INCLUDE_DIRS})
target_link_libraries(myTarget PUBLIC ${RDKAFKA_LDFLAGS})
It finds the rdkafka library but when trying to build the target it still has undefined references. It does work with the glib library though.
EDIT: This is the output when configuring CMake:
-- Checking for module 'rdkafka'
-- Found rdkafka, version 1.8.0
-- Configuring done
-- Generating done
-- Build files have been written to:
Starting the build leads to this:
/usr/bin/ld: CMakeFiles/OPCKafkaBridge.dir/opc_kafka_bridge.c.o: in function `g_autoptr_cleanup_generic_gfree':
opc_kafka_bridge.c:(.text+0x6c6): undefined reference to `g_free'
/usr/bin/ld: CMakeFiles/OPCKafkaBridge.dir/opc_kafka_bridge.c.o: in function `glib_autoptr_clear_GError':
opc_kafka_bridge.c:(.text+0x6e8): undefined reference to `g_error_free'
/usr/bin/ld: CMakeFiles/OPCKafkaBridge.dir/opc_kafka_bridge.c.o: in function `glib_autoptr_clear_GKeyFile':
opc_kafka_bridge.c:(.text+0x726): undefined reference to `g_key_file_unref'
/usr/bin/ld: CMakeFiles/OPCKafkaBridge.dir/opc_kafka_bridge.c.o: in function `load_config_group':
opc_kafka_bridge.c:(.text+0x7a8): undefined reference to `g_key_file_get_keys'
/usr/bin/ld: opc_kafka_bridge.c:(.text+0x7eb): undefined reference to `g_log'
/usr/bin/ld: opc_kafka_bridge.c:(.text+0x822): undefined reference to `g_key_file_get_string'
/usr/bin/ld: opc_kafka_bridge.c:(.text+0x861): undefined reference to `g_log'
/usr/bin/ld: opc_kafka_bridge.c:(.text+0x8b9): undefined reference to `g_log'
/usr/bin/ld: CMakeFiles/OPCKafkaBridge.dir/opc_kafka_bridge.c.o: in function `dr_msg_cb':
opc_kafka_bridge.c:(.text+0x95b): undefined reference to `g_log'
/usr/bin/ld: CMakeFiles/OPCKafkaBridge.dir/opc_kafka_bridge.c.o: in function `sendKafkaMessage':
opc_kafka_bridge.c:(.text+0x9a4): undefined reference to `g_key_file_new'
/usr/bin/ld: opc_kafka_bridge.c:(.text+0x9d0): undefined reference to `g_key_file_load_from_file'
/usr/bin/ld: opc_kafka_bridge.c:(.text+0xa00): undefined reference to `g_log'
/usr/bin/ld: opc_kafka_bridge.c:(.text+0xaa0): undefined reference to `g_log'
/usr/bin/ld: opc_kafka_bridge.c:(.text+0xbc5): undefined reference to `g_log'
/usr/bin/ld: opc_kafka_bridge.c:(.text+0xc03): undefined reference to `g_log'
/usr/bin/ld: opc_kafka_bridge.c:(.text+0xc4e): undefined reference to `g_log'
/usr/bin/ld: CMakeFiles/OPCKafkaBridge.dir/opc_kafka_bridge.c.o:opc_kafka_bridge.c:(.text+0xca4): more undefined references to `g_log' follow
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/OPCKafkaBridge.dir/build.make:98: OPCKafkaBridge] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/OPCKafkaBridge.dir/all] Error 2
gmake: *** [Makefile:91: all] Error 2
I managed to get it to compile by creating a Makefile manually with the following contents:
CFLAGS=-Wall $(shell pkg-config --cflags glib-2.0 rdkafka)
LDLIBS=$(shell pkg-config --libs glib-2.0 rdkafka)
I hope someone can help me configure should there be a mistake with the way I am trying to link to the library or point me in the right direction if it's correct and the problem is something different.
librdkafka provides a CMake config file and pkg-config files, so you have 2 solutions:
find_package(RdKafka REQUIRED)
target_link_libraries(myTarget PUBLIC RdKafka::rdkafka)
or
find_package(PkgConfig REQUIRED)
pkg_check_modules(rdkafka REQUIRED IMPORTED_TARGET rdkafka)
target_link_libraries(myTarget PUBLIC PkgConfig::rdkafka)
if you want to link rdkafka++:
find_package(RdKafka REQUIRED)
target_link_libraries(myTarget PUBLIC RdKafka::rdkafka++)
or
find_package(PkgConfig REQUIRED)
pkg_check_modules(rdkafka++ REQUIRED IMPORTED_TARGET rdkafka++)
target_link_libraries(myTarget PUBLIC PkgConfig::rdkafka++)

C Programming of Libharu on Debian

I having a lot of problems setting up my programming environment on Debian. I am trying to write a C program to create pdf documents. I have installed libharu by issuing the following command
sudo apt-get install libhpdf-dev
I can find hpdf.h in /usr/include folder. I am trying to make sure that the program is installed properly by using a sample code (http://libharu.sourceforge.net/demo/text_demo.c) I found on the internet.
I tried compiling the program by issuing the following command:
gcc pdf.c and was treated to a long list of errors:
/usr/bin/ld: /tmp/ccR8ovya.o: in function `main':
pdf.c:(.text+0xb4): undefined reference to `HPDF_New'
/usr/bin/ld: pdf.c:(.text+0xf1): undefined reference to `HPDF_Free'
/usr/bin/ld: pdf.c:(.text+0x107): undefined reference to `HPDF_AddPage'
/usr/bin/ld: pdf.c:(.text+0x117): undefined reference to `HPDF_Page_GetHeight'
/usr/bin/ld: pdf.c:(.text+0x12a): undefined reference to `HPDF_Page_GetWidth'
/usr/bin/ld: pdf.c:(.text+0x145): undefined reference to `HPDF_Page_SetLineWidth'
/usr/bin/ld: pdf.c:(.text+0x18c): undefined reference to `HPDF_Page_Rectangle'
/usr/bin/ld: pdf.c:(.text+0x198): undefined reference to `HPDF_Page_Stroke'
/usr/bin/ld: pdf.c:(.text+0x1b0): undefined reference to `HPDF_GetFont'
/usr/bin/ld: pdf.c:(.text+0x1cf): undefined reference to `HPDF_Page_SetFontAndSize'
/usr/bin/ld: pdf.c:(.text+0x1e2): undefined reference to `HPDF_Page_TextWidth'
/usr/bin/ld: pdf.c:(.text+0x1f5): undefined reference to `HPDF_Page_BeginText'
/usr/bin/ld: pdf.c:(.text+0x23d): undefined reference to `HPDF_Page_TextOut'
/usr/bin/ld: pdf.c:(.text+0x249): undefined reference to `HPDF_Page_EndText'
/usr/bin/ld: pdf.c:(.text+0x255): undefined reference to `HPDF_Page_BeginText'
/usr/bin/ld: pdf.c:(.text+0x270): undefined reference to `HPDF_Page_SetFontAndSize'
/usr/bin/ld: pdf.c:(.text+0x29f): undefined reference to `HPDF_Page_TextOut'
/usr/bin/ld: pdf.c:(.text+0x2ab): undefined reference to `HPDF_Page_EndText'
/usr/bin/ld: pdf.c:(.text+0x2b7): undefined reference to `HPDF_Page_BeginText'
/usr/bin/ld: pdf.c:(.text+0x2df): undefined reference to `HPDF_Page_MoveTextPos'
/usr/bin/ld: pdf.c:(.text+0x320): undefined reference to `HPDF_GetFont'
/usr/bin/ld: pdf.c:(.text+0x33f): undefined reference to `HPDF_Page_SetFontAndSize'
/usr/bin/ld: pdf.c:(.text+0x364): undefined reference to `HPDF_Page_ShowText'
/usr/bin/ld: pdf.c:(.text+0x37c): undefined reference to `HPDF_Page_MoveTextPos'
/usr/bin/ld: pdf.c:(.text+0x397): undefined reference to `HPDF_Page_SetFontAndSize'
/usr/bin/ld: pdf.c:(.text+0x3aa): undefined reference to `HPDF_Page_ShowText'
/usr/bin/ld: pdf.c:(.text+0x3c2): undefined reference to `HPDF_Page_MoveTextPos'
/usr/bin/ld: pdf.c:(.text+0x3f1): undefined reference to `HPDF_Page_EndText'
/usr/bin/ld: pdf.c:(.text+0x407): undefined reference to `HPDF_SaveToFile'
/usr/bin/ld: pdf.c:(.text+0x413): undefined reference to `HPDF_Free'
collect2: error: ld returned 1 exit status
It seems that the compiler is having problem finding hpdf.h.
The answer was in the website.
gcc -o testpdf -O2 -Wall testpdf.c -lhpdf -lz
http://libharu.sourceforge.net/compile_your_program.html

Cannot compile hackrf.c

I try to compile/build hackrf.c since i'm using the library in another code, I have hackrf.h in the same directory as the one i'm building hackrf.c in...
https://github.com/greatscottgadgets/hackrf/tree/master/host/libhackrf/src
Ideally, it should do so, but instead I get these errors in the terminal:
choza#chozaUbuntu:~/Documents/workspace_c$ gcc hackrf.c
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x24): undefined reference to `main'
/usr/bin/ld: /tmp/ccrRkrH1.o: in function `cancel_transfers':
hackrf.c:(.text+0x139): undefined reference to `libusb_cancel_transfer'
/usr/bin/ld: /tmp/ccrRkrH1.o: in function `free_transfers':
hackrf.c:(.text+0x25b): undefined reference to `libusb_free_transfer'
/usr/bin/ld: /tmp/ccrRkrH1.o: in function `allocate_transfers':
hackrf.c:(.text+0x337): undefined reference to `libusb_alloc_transfer'
/usr/bin/ld: /tmp/ccrRkrH1.o: in function `prepare_transfers':
hackrf.c:(.text+0x484): undefined reference to `libusb_submit_transfer'
/usr/bin/ld: /tmp/ccrRkrH1.o: in function `detach_kernel_drivers':
hackrf.c:(.text+0x4ee): undefined reference to `libusb_get_device'
/usr/bin/ld: hackrf.c:(.text+0x505): undefined reference to `libusb_get_active_config_descriptor'
/usr/bin/ld: hackrf.c:(.text+0x53b): undefined reference to `libusb_free_config_descriptor'
/usr/bin/ld: hackrf.c:(.text+0x555): undefined reference to `libusb_kernel_driver_active'
/usr/bin/ld: hackrf.c:(.text+0x592): undefined reference to `libusb_detach_kernel_driver'
And so on...
Then I suppose I should directly link libusb...
But I get this:
choza#chozaUbuntu:~/Documents/workspace_c$ gcc hackrf.c -lusb-1.0
/usr/bin/ld: /tmp/ccfIzbqD.o: undefined reference to symbol 'pthread_join##GLIBC_2.2.5'
/usr/bin/ld: /lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
And pthread...
choza#chozaUbuntu:~/Documents/workspace_c$ gcc hackrf.c -lusb-1.0 -pthread
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x24): undefined reference to `main'
collect2: error: ld returned 1 exit status
I really don't know how to fix the error above or how to successfully compile the .c file anymore.
I'm using VS Code in Ubuntu 20.04.
What should I do?
I really don't know how to fix the error above or how to successfully compile the .c file anymore.
You aren't having a problem compiling, you are having a problem linking.
The reason your link fails is that hackrf.c lacks main() function, which every C program requires. And that's because it's part of a library.
Generally you'll want to build the entire project, not just a library, using the instructions the project provides.
If you do want to build a library, then you should link it with the rest of your program.

Word Embedding Compression by Binarization (Tissier) // C-Binaries

For my bachelor thesis I want to apply this algorithm proposed here: Binarization by Tissier
I cloned the repository and tried to run cd near-lossless-binarization in the corrsponding directory.
However there comes up an error I don't know how to solve.
cd near-lossless-binarization && make
gcc binarize.c -o binarize -ansi -pedantic -Wall -Wextra -Wno-unused-result -Ofast -funroll-loops -lblas -lm
/usr/bin/ld: /tmp/ccxe5d0J.o: in function `apply_regularizarion_gradient':
binarize.c:(.text+0xddc): undefined reference to `cblas_sgemm'
/usr/bin/ld: binarize.c:(.text+0xf9e): undefined reference to `cblas_sgemm'
/usr/bin/ld: /tmp/ccxe5d0J.o: in function `apply_reconstruction_gradient':
binarize.c:(.text+0x1059): undefined reference to `cblas_sgemm'
/usr/bin/ld: binarize.c:(.text+0x12fb): undefined reference to `cblas_sgemm'
/usr/bin/ld: binarize.c:(.text+0x1800): undefined reference to `cblas_sgemm'
/usr/bin/ld: /tmp/ccxe5d0J.o:binarize.c:(.text+0x1e71): more undefined references to `cblas_sgemm' follow
collect2: Error: ld gab 1 as end-Status returned
Seems like there is an issue inside the corresponding file.
I already opened an issue in the repo, but need answers pretty soon..
Hoped to find anyone with C experience here who may solve my problem.
Requirements named in the repo are fulfilled.

Gcc throws error when I try to compile the test folder in libburn

Libburn
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:
An editor to write the source code.
A compiler to translate the source code into object code, which consists mainly of machine code, whose references are not yet resolved.
A linker to link (to bind) separated parts of object code into an executable, which has all references resolved.
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.

Resources