1、错误展示:

hangma@ubuntu:~/test/test/protest/stack_test$ gcc  -c my_stack.c -o my_stack.o
In file included from /usr/include/stdio.h:34:0,
                 from my_stack.c:2:
/usr/lib/gcc/i686-linux-gnu/4.7/include/stddef.h:213:9: error: expected ‘;’, identifier or ‘(’ before ‘unsigned’
In file included from /usr/include/stdio.h:75:0,
                 from my_stack.c:2:
/usr/include/libio.h:334:3: error: expected specifier-qualifier-list before ‘size_t’
/usr/include/libio.h:366:62: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/libio.h:375:6: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/libio.h:497:19: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_IO_sgetn’
In file included from my_stack.c:2:0:
/usr/include/stdio.h:320:35: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:326:47: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:338:20: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:345:10: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:387:44: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:391:45: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:663:11: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:666:9: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:676:8: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:706:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fread’
/usr/include/stdio.h:712:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fwrite’
/usr/include/stdio.h:734:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fread_unlocked’
/usr/include/stdio.h:736:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fwrite_unlocked’
In file included from my_stack.c:3:0:
/usr/include/stdlib.h:140:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__ctype_get_mb_cur_max’
In file included from my_stack.c:3:0:
/usr/include/stdlib.h:337:4: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:367:4: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:471:22: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:473:22: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:473:38: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:485:36: error: expected declaration specifiers or ‘...’ before ‘size_t’
In file included from /usr/include/stdlib.h:497:0,
                 from my_stack.c:3:
/usr/include/alloca.h:33:22: error: expected declaration specifiers or ‘...’ before ‘size_t’
In file included from my_stack.c:3:0:
/usr/include/stdlib.h:503:22: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:508:45: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:508:65: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:756:9: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:756:25: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:761:34: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:761:50: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:840:6: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:843:6: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:847:31: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:851:31: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:860:38: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:864:36: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:871:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mbstowcs’
/usr/include/stdlib.h:874:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘wcstombs’
my_stack.c: In function ‘CreateStack’:
my_stack.c:24:16: warning: incompatible implicit declaration of built-in function ‘malloc’ [enabled by default]

错误解决方式:

将.c文件中的系统头文件放在自己写的头文件前边就可以了

2、错误提示:

hangma@ubuntu:~/test/test/protest/stack_test$ gcc  -c my_stack.c -o my_stack.o
my_stack.c:7:1: error: expected ‘;’, identifier or ‘(’ before ‘int’

错误解决:在我的头文件中,定义的结构体最后忘记加分号了

ubuntu下编译时遇到的错误及解决方式的更多相关文章

  1. 全志tina v3.0系统编译时的时间错误的解决(全志SDK的维护BUG)

    全志tina v3.0系统编译时的时间错误的解决(全志SDK的维护BUG) 2018/6/13 15:52 版本:V1.0 开发板:SC3817R SDK:tina v3.0 1.01原始编译全志r1 ...

  2. [C++]Linux之Ubuntu下编译C程序出现错误:“ stray ‘\302'或者'\240' in program”的解决方案

    参考文献:[error: stray ‘\240’ in program或 error: stray ‘\302’ in program](http://blog.csdn.net/u01299585 ...

  3. ubuntu下Qt cannot find -lGL错误的解决方法 (转载)

    在ubuntu下使用Qt 编译时候遇上了cannot find -lGL错误,使用命令 sudo apt-get install libqt4-dev或者sudo apt-get install li ...

  4. iOS开发笔记:编译时出现的错误和解决办法

    1."std::ios_base::Init::~Init()", referenced from 出现这样的编译问题,是需要再加进libstdc++.dylib和libstdc+ ...

  5. windows下建立文件的换行符^M导致linux下的shell脚本执行错误的解决方式

    常常在windows下编辑的文件远程传送到linux下的时候每行末尾都会出现^M.这将导致shell脚本执行错误,主要是由于dos下的编辑器和linux下的编辑器对文件末行的回车符处理不一致导致. 主 ...

  6. ubuntu下编译caffe

    Ubuntu下编译caffe 纯粹是个人编译的记录.不用CUDA(笔记本是amd卡,万恶的nvidia):不手动编译依赖包(apt-get是用来干啥的?用来直接装二进制包,以及自动解决依赖项的) ca ...

  7. ubuntu下编译VLC

    ubuntu下编译VLC 标签(空格分隔): ubuntu vlc 视频 编译 [TOC] 1.下载VLC源码包并解压 VLC的源码包在VLC的官网有,可以直接下载.也可以使用git来clone一个. ...

  8. ubuntu下编译java程序

    ubuntu下编译java程序 首先需要安装jdk,并配置好相应环境变量 下面以简单的HelloWorld为例 文件名为HelloWorld.java java代码: public class Hel ...

  9. 在Ubuntu下编译wpa_supplicant

    最近在研究WiFi联盟的多屏互动协议Miracast,其中需要用到wpa_supplicant,编译中遇到了一些问题,经过一下午的折腾也都解决了,下面分享给各位. 一.编译需要用到三个库源码包,分别是 ...

随机推荐

  1. 图片左右循环连续滚动代码,解决marquee的留白问题

    <marquee ONMOUSEOUT="this.start()" ONMOUSEOVER="this.stop()" DIRECTION=" ...

  2. uploadify上传大文件时出现404错误

    出现这个错误的话一般是IIs限制了文件大小.IIS7下的默认设置限制了上传大小.这个时候Web.Config中的大小设置也就失效了.具体步骤:1.打开IIS管理器,找到Default Web Site ...

  3. NuGet学习笔记(1)——初识NuGet及快速安装使用(转)

    关于NuGet园子里已经有不少介绍及使用经验,本文仅作为自己研究学习NuGet一个记录. 初次认识NuGet是在去年把项目升级为MVC3的时候,当时看到工具菜单多一项Library Package M ...

  4. C#判断网站运行状态是否正常

    我使用的是控制台应用程序来监控网站的运行状态,通过判断网站请求头(HEAD)来判断是否运行正常 下面列出几种常见的网站状态码 StatusCode 数字表示 OK 200. OK 指示请求成功,且请求 ...

  5. JAVA List与数组间相互转换

    1.list转数组 例如: List<String> list =  new ArrayList<String>(); list.add("aa"); li ...

  6. oralce中exists not exists in not in对于NULL的处理

    1.   先讨论 in 与 not in中存在NULL的情况, sql语句如下: 1 select 1 result1 from dual where 1 not in (2, 3); 2 3 4 s ...

  7. php引用传值

    isset();判读值是否值在 unset();取消变量 <?php$a=array("a","b","c");$b=$a;$b[2] ...

  8. java第一天的疑问

    1字节 的 byte 2字节 的 char 精度 byte<short<char<int<long<float<double 随便打个整数默认为int 随便打个小数 ...

  9. 分别给出BOOL,int,float,指针变量 与“零值”比较的 if 语句(假设变量名为var)

    BOOL型变量:if(!var)    int型变量: if(var==0)    float型变量:    const float EPSINON = 0.00001;    if ((x > ...

  10. vim编辑器命令

    Vim介绍 vim(vimsual)是Linux/Unix系列OS中通用的全屏编辑器. vim分为两种状态,即命令状态和编辑状态,在命令状态下,所键入的字符系统均作为命令来处理,如:q代表退出,而编辑 ...