Click here to Skip to main content
15,918,808 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi Team,
I have a problem compiling small code using ncurses.h library and below is the error message during the compilation.

gcc test.c -lncurses
VB
/tmp/cc7AaJ8n.o: In function `main':
test.c:(.text+0xc0): undefined reference to `new_item'
test.c:(.text+0xdd): undefined reference to `new_menu'
test.c:(.text+0x131): undefined reference to `set_menu_win'
test.c:(.text+0x16d): undefined reference to `set_menu_sub'
test.c:(.text+0x189): undefined reference to `set_menu_format'
test.c:(.text+0x19d): undefined reference to `set_menu_mark'
test.c:(.text+0x2d3): undefined reference to `post_menu'
test.c:(.text+0x3aa): undefined reference to `menu_driver'
test.c:(.text+0x3c0): undefined reference to `menu_driver'
test.c:(.text+0x3d6): undefined reference to `menu_driver'
test.c:(.text+0x3ec): undefined reference to `menu_driver'
test.c:(.text+0x422): undefined reference to `unpost_menu'
test.c:(.text+0x42e): undefined reference to `free_menu'
test.c:(.text+0x44d): undefined reference to `free_item'
collect2: ld returned 1 exit status

Additional info:

uname -a:
Linux localhost.localdomain 2.6.33.3-85.fc13.i686 #1 SMP Thu May 6 18:44:12 UTC 2010 i686 i686 i386 GNU/Linux

OS: Fedora

Please guide me in resolving this issue.

Regards,
Kiran
Posted
Comments
Sergey Alexandrovich Kryukov 20-Jun-11 1:42am    
How anyone can know your bugs without looking at your code?
--SA
OriginalGriff 20-Jun-11 3:07am    
SA is absolutely right: Use the "Improve question" widget to edit you question and provide relevant code fragments. Without these, we cannot tell what the error message it referring to, and cannot help you!
[no name] 1-Jul-11 2:27am    
sorry..it was my mistake. I tried linking the menu.h file during compilation and it worked. Thanks for pointing out such mistakes from my side. It helps improving myself.

Regards,
Kiran

1 solution

You are using functions in the ncurses menu library which is separate from the main ncurses library. Add -lmenu to your compiler command line. See: http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/menus.html#COMPILEMENUS[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900