peterbay / camera-control

Simple command-line application for controlling camera settings through V4L2.
GNU General Public License v3.0
29 stars 2 forks source link

Linking fails for ncurses #1

Open antzucaro opened 3 years ago

antzucaro commented 3 years ago

Hi @peterbay, I'm having trouble compiling on Ubuntu 18.04. After having installed the prerequisites I run make, but it gives me errors with linking that appear to be related to ncurses:

$ make
gcc -Wall -O2 -std=c99 -D_GNU_SOURCE -D_DEFAULT_SOURCE -D_GNU_SOURCE -D_DEFAULT_SOURCE -I/usr/include/ncursesw -c camera-ctl.c -o camera-ctl.o
gcc -Wall -O2 -std=c99 -D_GNU_SOURCE -D_DEFAULT_SOURCE -D_GNU_SOURCE -D_DEFAULT_SOURCE -I/usr/include/ncursesw -lncurses -ltinfo -lncursesw -ltinfo camera-ctl.o -o camera-ctl
camera-ctl.o: In function `print_control_info':
camera-ctl.c:(.text+0x203): undefined reference to `werase'
camera-ctl.c:(.text+0x221): undefined reference to `wborder'
camera-ctl.c:(.text+0x24c): undefined reference to `mvwprintw'
camera-ctl.c:(.text+0x273): undefined reference to `mvwprintw'
camera-ctl.c:(.text+0x29a): undefined reference to `mvwprintw'
camera-ctl.c:(.text+0x2c1): undefined reference to `mvwprintw'
camera-ctl.c:(.text+0x2e8): undefined reference to `mvwprintw'
camera-ctl.o:camera-ctl.c:(.text+0x30f): more undefined references to `mvwprintw' follow
camera-ctl.o: In function `print_menu':
camera-ctl.c:(.text+0x5d0): undefined reference to `wborder'
<snipped>

I'm not familiar enough with C to figure out why this is happening, but I'd venture a guess that it's something simple. Could you take a look when you get the time? Thank you!

mrmees commented 1 month ago

For anyone that comes along looking for this - I added "-lncurses" to the end of the generated make command and ran it instead of make. Works as expected.

$ make V=1
-> gcc -W -Wall -g -O3 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -lncursesw -ltinfo camera-ctl.o -o camera-ctl

This command will compile the program:

gcc -W -Wall -g -O3 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -lncursesw -ltinfo camera-ctl.o -o camera-ctl -lncurses

Then run:

./camera-ctl