Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linking fails for ncurses #1

Open
antzucaro opened this issue Jan 8, 2021 · 1 comment
Open

Linking fails for ncurses #1

antzucaro opened this issue Jan 8, 2021 · 1 comment

Comments

@antzucaro
Copy link

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
Copy link

mrmees commented Aug 30, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants