链接不过阿 求助!

编译打包和其他
回复
lidan113lidan
帖子: 3
注册时间: 2009-12-06 20:27

链接不过阿 求助!

#1

帖子 lidan113lidan » 2010-02-08 19:58

大家好 小菜我最近写了个c代码 但是链接不上去阿 不知道什么原因 代码和错误贴上 望那位大哥指点
#include<stdio.h> //basic i/o
#include<curses.h> //shell window control
#include<sys/time.h>
#include<stdlib.h>
#include<signal.h> //signal();
#define COLS 30
#define message "hello"
#define blank " "
int row;
int col;
int dir;
int main()
{
int delay; //delay time
int ndelay; //new delay time
int c; //user input
void move_msg(int); //handler for timer
initscr();
crmode();
noecho();
clear();
row=10; //set initialize row value
col=0; //set initialize column value
dir=1; //set initialize direction
delay=200; //ms
mov(row,col); //move cursor to the specified location
addstr(message);//draw message in the specified location
signal(SIGALRM,move_msg);
//specified move_msg to process the SIGALRM message
set_ticker(delay); //set new delay time to control speed in there
while(1)
{
ndelay=0; //set new delay=0 when start
c=getch(); //get a char from input
if(c=='Q') break;
if(c==' ') dir = -dir;
if((c=='f')&&(delay>2))
ndelay=delay/2;
// increase the speed by slow down the interval time
if(c=='s') ndelay=delay*2; // slow down
if(ndelay>0)
set_ticker(delay=ndelay); // reset delay&&timer
}
endwin();
return 0; //procedure terminated
}
void move_msg(int signum) //process the message from timer
{
signal(SIGALRM,move_msg); //not necccessary
move(row,col); //set blank
addstr(blank);
col+-dir; //set new column
move(row,col);
addstr(message); //set message
refresh();
if(dir==-1&&col<=0) //when move to start
dir = 1;
else if((dir == 1) && (col + 7>=COLS))
dir=-1;
}
int set_ticker(int n_msecs)
{
struct itimerval new_timeset;
long n_sec,n_usecs;
n_sec=n_msecs/1000;
n_usecs=(n_msecs%1000)*1000L;
new_timeset.it_interval.tv_sec=n_sec;
new_timeset.it_interval.tv_usec=n_usecs;
new_timeset.it_value.tv_sec=n_sec;
new_timeset.it_value.tv_usec=n_usecs;
return setitimer(ITIMER_REAL,&new_timeset,NULL);
}
编译命令和提示的错误信息是
administrator@ubuntu:~$ cc bounceld1.c -l curses -o bounceld
/tmp/ccASgicj.o: In function `main':
bounceld1.c.text+0x5e): undefined reference to `mov'
collect2: ld returned 1 exit status
谢谢
头像
wzssyqa
帖子: 4010
注册时间: 2008-04-07 17:36
来自: 泰安人在阜新

Re: 链接不过阿 求助!

#2

帖子 wzssyqa » 2010-02-08 21:49

选项中加上 -lcurses
tusooa
帖子: 6548
注册时间: 2008-10-31 22:12
系统: 践兔
联系:

Re: 链接不过阿 求助!

#3

帖子 tusooa » 2010-02-20 9:56

没有mov这个函数。
应该是move吧

代码: 全选

] ls -ld //
回复