error: /usr/include/stdio.h: Permission denied 的一种情况分析

代码:

  1. #include <stdio.h>
  2. int main(){
  3. printf ("hello long size %d\n",sizeof(long));
  4. }

很简单,测试是否能够编译通过
对比

  • 在root的用户下编译正常通过
  • 在其他用户测试不通过

    点击(此处)折叠或打开

    1. ~> gcc test.c
    2. test.c:1:19: error: /usr/include/stdio.h: Permission denied
    3. test.c: In function 'main':
    4. test.c:5: warning: incompatible implicit declaration of built-in function 'printf'

尝试着解决问题

提示说是权限受限。
在root用户下看看stdio.h的属性

点击(此处)折叠或打开

  1. ll /usr/include/stdio.h
  2. -rw-r--r-- 1 root root 31144 2010-05-06 10:33 /usr/include/stdio.h

具有可读属性,但是用vim打开,显示是个 [new file], 为什么呢?
具有可读权限就是看不到文件!

给文档添加可执行权限,chmod +x /usr/include/stdio.h
问题如故

给link添加可执行权限,# find /usr/include/ -type l -exec ls -l {} \;
问题如故

去除link的可执行权限,# find /usr/include/ -type l -exec chmod -x  {} \;

给文件夹添加可执行权限,# find /usr/include/ -type d -exec chmod +x  {} \;
问题解决

分析
    我不明白,打开/usr/include/stdio.h 和其他文件夹的可执行权限有什么相关,因为/usr/include和/usr/include/stdio.h 都具有可行性,用户应该可以读取stdio.h文件才对啊。
   
这个情况出现在移植的过程中,为了防止不必要的麻烦,添加如下命令,chmod -R 755 /usr/include/

error: /usr/include/stdio.h: Permission denied 的一种情况分析的更多相关文章

  1. error: /usr/include/objc/objc-class.h: No such file or directory

    When i use the example of ShareKit package,i have come across this error:"error: /usr/include/o ...

  2. #include <stdio.h>

    1 fflush 2 fgetc 3 fgets 4 fprintf 5 fputc 6 fputs 7 fscanf 8 fseek 9 ftell 10 perror 11 remove 12 r ...

  3. 第二次作业#include <stdio.h> int main() { int a,b,c,d,e; printf("请输入一个不多于五位的整数:\n"); scanf("%d",&a); if(a>=100000||a<=0) { printf("输入格式错误! \n"); } else { if(

    1 判断成绩等级 给定一百分制成绩,要求输出成绩的等级.90以上为A,80-89为B,70-79为C,60-69为D,60分以下为E,输入大于100或小于0时输出"输入数据错误". ...

  4. git报错 error: cannot stat ‘'web/js': Permission denied

    切换分支时报错: error: cannot stat ‘'web/js': Permission denied 解决方法:退出编辑器.浏览器.资源管理器等,然后再切换就可以了.

  5. c语言输入与输出库函数#include<stdio.h>

    last modified: 2010-05-28 输入与输出<stdio.h> 头文件<stdio.h>定义了用于输入和输出的函数.类型和宏.最重要的类型是用于声明文件指针的 ...

  6. [pod install] error: cannot open .git/FETCH_HEAD: Permission denied

    pod installAnalyzing dependencies[!] Pod::Executable pull error: cannot open .git/FETCH_HEAD: Permis ...

  7. #include<stdio.h> #include "stdio.h"

    https://baike.baidu.com/item/#include <stdio.h> #include <stdio.h> 编辑 #include<stdio. ...

  8. #include stdio.h(B)

    #include <stdio.h> int main() { //***********一.循环语句*************** //什么叫做循环: //重复的做某件事情,重复的执行一 ...

  9. #include stdio.h(A)

    /* 第一个*******知识点工程相关信息******** 1.创建工程 文件->新建->工程->win32 console applecation ->文件名不能为汉字 2 ...

随机推荐

  1. 使用GridView来获取xml文件数据

    在任何一个系统中,数据的读取和编辑都是至关重要的.无论你是CS还是BS,都需要对数据进行操作.其实 我们可以发现,很多软件和系统最终都是对于数据库中数据的处理.之前在CS的学习过程中我们接触到了很多 ...

  2. VMware Workstation下VMnet1等虚拟网卡与主机网卡之间的关系

    VMware Workstation下VMnet1等虚拟网卡与主机网卡之间的关系 本文出自 "王春海的博客" http://wangchunhai.blog.51cto.com/2 ...

  3. Qt学习之路:自定义Model三篇,自定义委托等等

    http://devbean.blog.51cto.com/448512/d-8/p-2

  4. QList 和std::list的比较

    QList QList<T> 是一个Qt通用容器类.它存储一序列的值,并且提供基于索引的数据访问方法和快速的插入和删除操作. QList<T>, QLinkedList< ...

  5. 分享非常有用的Java程序 (关键代码)(四)---动态改变数组的大小

    原文:分享非常有用的Java程序 (关键代码)(四)---动态改变数组的大小 /** * Reallocates an array with a new size, and copies the co ...

  6. Cocos2d-X游戏开发之Windows7+VS2010环境搭建(亲测)

    Cocos2d—X游戏引擎,提供Mac系统下的Xcode开发和Windows系统的VS开发,应该是比较常用的2种. 使用Mac以后,就会发现使用Xcode开发实在是福分啊.VS开发步骤繁琐,调试效率低 ...

  7. ListView 使用方法(Asp.Net)

    您将须要用到的独有数据绑定控件. Fritz Onion 代码下载位置: ExtremeASPNET2008_03.exe (192 KB) Browse the Code Online  文件夹 L ...

  8. android Bitmap(将视图转为bitmap对象)

    1)从android的资源文件夹layout中加载xml布局文件,并把布局文件映射为Bitmap main.xml文件如下: <?xmlversion="1.0"encodi ...

  9. RAC 11.2.0.4 安装 遇到 INS-06001

    今天安装11.2.0.4的grid软件,在配置passwordless SSH的时候,点击setup 出现此错误 开始网上搜了一把.说什么的都有,什么系统bug啊什么的 但是我另外一套rac却很正常就 ...

  10. 工作线程AfxBeginThread的使用

    工作线程通常用来执行一些后台任务,如:数据计算.后台杀毒等等.因为不需要创建窗口和处理用户消息,编写比较容易,在程序中只要调用AfxBeginThread 函数就可以创建并启动一个工作线程了. Afx ...