简体   繁体   中英

How can i compile C programs with Makefile on ubuntu?

I am trying to compile some programs i have found on github. The repository is at the following URL: [enter link description here][1]

https://github.com/iagox86/nbtool

I have little knowledge of C programs, however when i try to use GCC with the following command i receive errors. the command i have tried is:

gcc -o dnslogger dnslogger.c

I receive the following error:

/tmp/ccLRFQbp.o: In function `dns_callback':
dnslogger.c:(.text+0x51): undefined reference to `dns_create_from_packet'
dnslogger.c:(.text+0x5f): undefined reference to `dns_create'
dnslogger.c:(.text+0x10e): undefined reference to `dns_add_question'
dnslogger.c:(.text+0x179): undefined reference to `dns_add_answer_A'
dnslogger.c:(.text+0x1dc): undefined reference to `dns_add_answer_AAAA'
dnslogger.c:(.text+0x214): undefined reference to `dns_to_packet'
dnslogger.c:(.text+0x236): undefined reference to `udp_send'
dnslogger.c:(.text+0x260): undefined reference to `dns_create_error_string'
dnslogger.c:(.text+0x282): undefined reference to `udp_send'
dnslogger.c:(.text+0x28e): undefined reference to `safe_free'
dnslogger.c:(.text+0x29a): undefined reference to `dns_destroy'
dnslogger.c:(.text+0x2a6): undefined reference to `dns_destroy'
/tmp/ccLRFQbp.o: In function `dns_poll':
dnslogger.c:(.text+0x2d7): undefined reference to `select_group_create'
dnslogger.c:(.text+0x304): undefined reference to `select_group_add_socket'
dnslogger.c:(.text+0x321): undefined reference to `select_set_recv'
dnslogger.c:(.text+0x336): undefined reference to `select_group_do_select'
/tmp/ccLRFQbp.o: In function `cleanup':
dnslogger.c:(.text+0x36b): undefined reference to `select_group_destroy'
dnslogger.c:(.text+0x37a): undefined reference to `safe_free'
dnslogger.c:(.text+0x384): undefined reference to `print_memory'
/tmp/ccLRFQbp.o: In function `main':
dnslogger.c:(.text+0x6ed): undefined reference to `safe_malloc_internal'
dnslogger.c:(.text+0x718): undefined reference to `winsock_initialize'
dnslogger.c:(.text+0x934): undefined reference to `dns_do_test'
dnslogger.c:(.text+0xaab): undefined reference to `udp_create_socket'
dnslogger.c:(.text+0xb5f): undefined reference to `drop_privileges'
collect2: error: ld returned 1 exit status

the repository has a Makefile file which i suspect is used to compile the programs, but i am not sure of the exact commands to use on ubuntu, i have tried some of the commands but i receive errors when using the supplied commands from the file. the makefile is located here:

https://github.com/iagox86/nbtool/blob/master/Makefile

How can i compile these programs from ubuntu command line?

Just run make .

git clone https://github.com/iagox86/nbtool
cd nbtool
make

You need some programs to compile everything (samples) though. (make will complain if they're missing on your system)

If you're more interested in the Makefile itself, use the links in the comments or read specific documentation for example Gnu Make (I chose Gnu Make, as tags specify ubuntu explicitly)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM