【发布时间】:2014-10-13 20:56:15
【问题描述】:
我正在尝试在 Ubuntu 14.04 上编译以下内容,但收到错误消息。谁能指出我正确的方向?我试过-lpthread 没有效果。
编译:
gcc main.c -o terminal-app -lcdk -lpthread
main.c(从here 复制粘贴,以备
#include <cdk/cdk.h>
void main()
{
CDKSCREEN *cdkscreen;
CDKLABEL *demo;
WINDOW *screen;
char *mesg[4];
/* Initialize the Cdk screen. */
screen = initscr();
cdkscreen = initCDKScreen (screen);
/* Start CDK Colors */
initCDKColor();
/* Set the labels up. */
mesg[0] = "</31>This line should have a yellow foreground and a cyan background.<!31>";
mesg[1] = "</05>This line should have a white foreground and a blue background.<!05>";
mesg[2] = "</26>This line should have a yellow foreground and a red background.<!26>";
mesg[3] = "<C>This line should be set to whatever the screen default is.";
/* Declare the labels. */
demo = newCDKLabel (cdkscreen, CENTER, CENTER, mesg, 4, TRUE, TRUE);
/* Draw the label */
drawCDKLabel (demo, TRUE);
waitCDKLabel (demo, ' ');
/* Clean up */
destroyCDKLabel (demo);
destroyCDKScreen (cdkscreen);
endCDK();
exit (0);
}
错误:
/usr/bin/ld: /tmp/ccUtj1kg.o: undefined reference to symbol 'initscr'
//lib/x86_64-linux-gnu/libncurses.so.5: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
【问题讨论】:
标签: gcc compiler-errors ncurses