Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4263089
  • 博文数量: 1148
  • 博客积分: 25453
  • 博客等级: 上将
  • 技术积分: 11949
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-06 21:14
文章分类

全部博文(1148)

文章存档

2012年(15)

2011年(1078)

2010年(58)

分类: C/C++

2011-05-14 20:49:08


  1. ywx@yuweixian:~/yu/professional/4$ gcc pthread_exit.c -lpthread -o pthread_exit
  2. pthread_exit.c: In function ‘main’:
  3. pthread_exit.c:22: warning: incompatible implicit declaration of built-in function ‘exit’
  4. pthread_exit.c:28: warning: incompatible implicit declaration of built-in function ‘free’
  5. pthread_exit.c: In function ‘helloworld’:
  6. pthread_exit.c:35: warning: incompatible implicit declaration of built-in function ‘malloc’
  7. pthread_exit.c:37: warning: format ‘%p’ expects type ‘void *, but argument 2 has type ‘pthread_t’
  8. pthread_exit.c:38: warning: incompatible implicit declaration of built-in function ‘memset’

当我们遇到上面的问题比如:
 pthread_exit.c:22: warning: incompatible implicit declaration of built-in function ‘exit’

警告:不兼容得 隐式声明的 内置函数 “exit”


这说明没有 exit 这个 头文件,,我们需要加上响应的头文件

这里有一种很方便的方法:

    man  exit   就可看到需要的头文件 我们加上就可以了
 
   #include

  1. ywx@yuweixian:~/yu/professional/4$ man exit


  2. EXIT(3) Linux Programmer's Manual EXIT(3)

  3. NAME
  4.        exit - cause normal process termination

  5. SYNOPSIS
  6.        #include <stdlib.h>

  7.        void exit(int status);

  8. DESCRIPTION
  9.        The exit() function causes normal process termination and the value of
  10.        status & 0377 is returned to the parent (see wait(2)).

  11.        All functions registered with atexit(3) and on_exit(3) are called, in
  12.        the

阅读(1619) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~