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. vbs自学备份

    最小化所有窗口: Set obj = CreateObject("Shell.Application")obj.MinimizeAll 最小化某窗口: Const strTitle ...

  2. 【iOS与EV3混合机器人编程一系列五个】iOS_WiFi_EV3_Library 解剖连接EV3

    在上一篇文章中.我们解说了怎样用开源码库CocoaAsyncSocket来实现iOS上的UDP和TCP数据通信.那么在本文中.我们将介绍在CocoaAsyncSocket的基础怎样使用UDP和TCP连 ...

  3. android 支持的语言列表(汇总)

    Arabic, Egypt (ar_EG) -----------------------------阿拉伯语,埃及Arabic, Israel (ar_IL) ------------------- ...

  4. unity3d Find()使用

    1. Hierarchy 创建对象如两个cube时,未修改名称,名称都为cube时. js添加至Camera: private var cubeObj : GameObject; //private ...

  5. 商品标签例子——CSS3 transform 属性

    积累很重要.从此开始记录前端生涯的点滴.... <!DOCTYPE html><html lang="en"><head> <meta c ...

  6. Python基础练习

    近日,因工作需要要学习Python.为了不在语言细节中无法自拔,我按照网上广为流传的<程序员技术练级攻略>中python部分的学习计划,做了三个简单的练习,算是对python有了初步的了解 ...

  7. jquery的几种异步请求,ajax

    http://blog.csdn.net/a5489888/article/details/8523316

  8. SQL SERVER 查询特定的前几条数据

    1. 使用MS SQL Server 2008: 2. 数据库内容如下: insert into xuexi1 values('张三0', '数学', 98 ) insert into xuexi1 ...

  9. CUICatalog: Invalid asset name supplied: (null)

    出现这个问题的根本原因是你调用了[UIImage imageNamed:name]这个方法 但是name = nil;所以报出该错误.   解决方法,在项目中搜索[UIImage imageNamed ...

  10. iOS8中添加的extensions总结(四)——Action扩展

    Action扩展 注:此教程来源于http://www.raywenderlich.com的<iOS8 by Tutorials> 1.准备 本次教程利用网站bitly.com进行 bit ...