免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 10751 | 回复: 4
打印 上一主题 下一主题

/usr/bin/ld: cannot open output file ball: 权 权限不 权限不够 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-10-19 21:11 |只看该作者 |倒序浏览
[root@localhost chap10]# gcc -o ball ball.c -lcurses
/usr/bin/ld: cannot open output file ball: 权 权限不 权限不够
collect2: ld returned 1 exit status
[root@localhost chap10]#

在虚拟机安装的centos中编译
出现这个问题
请问怎么解决啊?
需要什么权限啊~
百度了下,也没什么好办法
谢谢大家了啊
  1. #include<curses.h>
  2. #include<time.h>
  3. #include<sys/time.h>
  4. #include<signal.h>
  5. #include<stdio.h>

  6. #define MAX(a,b) a>b?a:b
  7. #define MIN(a,b) a<b?a:b

  8. int col = 10;
  9. int row = 10;
  10. int direction = 1;
  11. char ball = 'O';
  12. int barx = 10;
  13. int bary = 10;
  14. char *bar = "__________";
  15. int bar_len = 10;

  16. int set_ticket(long n_msecs){
  17.         struct itimerval new_timeset;
  18.         long n_sec ,n_usec;
  19.         n_sec = n_msecs/1000;
  20.         n_usec = (n_msecs%1000)*1000L;
  21.         new_timeset.it_interval.tv_sec = n_sec;
  22.         new_timeset.it_interval.tv_usec = n_usec;
  23.         new_timeset.it_value.tv_sec = n_sec;
  24.         new_timeset.it_value.tv_usec = n_usec;

  25.         return setitimer(ITIMER_REAL,&new_timeset,NULL);
  26. }

  27. void paint(){

  28.         clear();
  29.         mvaddstr(bary, barx, bar);
  30.         mvaddch(row, col, ball);
  31.         refresh();
  32.         col+=direction;
  33.         if(col == COLS){
  34.                 direction = -1;
  35.                 col = COLS-1;
  36.                 beep();
  37.         }
  38.         if(col < 0 ){
  39.                 direction = 1;
  40.                 col = 0;
  41.                 beep();
  42.         }
  43. }

  44. int main(int argc, char *argv[]){

  45.         WINDOW *win;
  46.         int input;
  47.         long delay = 100;

  48.         win = initscr();
  49.         crmode();
  50.         noecho();
  51.         keypad(win,TRUE);

  52.         signal(SIGALRM,paint);
  53.         set_ticket(delay);

  54.         while((input=getch())&&input!=ERR&&input!='q' ){
  55.                 switch(input){
  56.                 case 'f':{
  57.                         delay/=2;
  58.                         set_ticket(delay);
  59.                         break;
  60.                                 }
  61.                 case 's':{
  62.                         delay*=2;
  63.                         set_ticket(delay);
  64.                         break;
  65.                                  }
  66.                 case KEY_RIGHT:{
  67.                         barx = MIN(barx+1,COLS-1-bar_len);
  68.                         break;
  69.                                                 }
  70.                 case KEY_LEFT:{
  71.                         barx=MAX(barx-1, 0);
  72.                         break;
  73.                                           }
  74.                 }
  75.         }

  76.         endwin();

  77.         return 0;
  78. }
复制代码

论坛徽章:
0
2 [报告]
发表于 2010-10-21 11:49 |只看该作者
ls -l /usr/bin/ld 和ball 看看是否有异常

论坛徽章:
0
3 [报告]
发表于 2010-10-22 18:59 |只看该作者
回复 2# china-yuan


    谢谢您了啊~这次不知道为什么就很正常了!重启下就好了~
    嘿嘿~
    不甚感激啊!

论坛徽章:
0
4 [报告]
发表于 2010-10-27 14:18 |只看该作者
有可能是重启,将ldconf的重新加载了或者你之前做了什么动作影响了权限

论坛徽章:
34
亥猪
日期:2015-03-20 13:55:11戌狗
日期:2015-03-20 13:57:01酉鸡
日期:2015-03-20 14:03:56未羊
日期:2015-03-20 14:18:30子鼠
日期:2015-03-20 14:20:14丑牛
日期:2015-03-20 14:20:31辰龙
日期:2015-03-20 14:35:34巳蛇
日期:2015-03-20 14:35:56操作系统版块每日发帖之星
日期:2015-11-06 06:20:00操作系统版块每日发帖之星
日期:2015-11-08 06:20:00操作系统版块每日发帖之星
日期:2015-11-19 06:20:00黄金圣斗士
日期:2015-11-24 10:43:13
5 [报告]
发表于 2010-10-27 17:37 |只看该作者
少库了?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP