ubuntu下编译时遇到的错误及解决方式
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下编译时遇到的错误及解决方式的更多相关文章
- 全志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 ...
- [C++]Linux之Ubuntu下编译C程序出现错误:“ stray ‘\302'或者'\240' in program”的解决方案
参考文献:[error: stray ‘\240’ in program或 error: stray ‘\302’ in program](http://blog.csdn.net/u01299585 ...
- ubuntu下Qt cannot find -lGL错误的解决方法 (转载)
在ubuntu下使用Qt 编译时候遇上了cannot find -lGL错误,使用命令 sudo apt-get install libqt4-dev或者sudo apt-get install li ...
- iOS开发笔记:编译时出现的错误和解决办法
1."std::ios_base::Init::~Init()", referenced from 出现这样的编译问题,是需要再加进libstdc++.dylib和libstdc+ ...
- windows下建立文件的换行符^M导致linux下的shell脚本执行错误的解决方式
常常在windows下编辑的文件远程传送到linux下的时候每行末尾都会出现^M.这将导致shell脚本执行错误,主要是由于dos下的编辑器和linux下的编辑器对文件末行的回车符处理不一致导致. 主 ...
- ubuntu下编译caffe
Ubuntu下编译caffe 纯粹是个人编译的记录.不用CUDA(笔记本是amd卡,万恶的nvidia):不手动编译依赖包(apt-get是用来干啥的?用来直接装二进制包,以及自动解决依赖项的) ca ...
- ubuntu下编译VLC
ubuntu下编译VLC 标签(空格分隔): ubuntu vlc 视频 编译 [TOC] 1.下载VLC源码包并解压 VLC的源码包在VLC的官网有,可以直接下载.也可以使用git来clone一个. ...
- ubuntu下编译java程序
ubuntu下编译java程序 首先需要安装jdk,并配置好相应环境变量 下面以简单的HelloWorld为例 文件名为HelloWorld.java java代码: public class Hel ...
- 在Ubuntu下编译wpa_supplicant
最近在研究WiFi联盟的多屏互动协议Miracast,其中需要用到wpa_supplicant,编译中遇到了一些问题,经过一下午的折腾也都解决了,下面分享给各位. 一.编译需要用到三个库源码包,分别是 ...
随机推荐
- 一般处理程序中使用Session出现未将对象引用设置到对象的实例
遇到问题:未将对象引用设置到对象的实例 那就在你的一般处理程序中加入红色背景的代码吧 using System; using System.Collections.Generic; using Sys ...
- 网络编程TCP总结及实践-C语言
网络变成首先要注意IP和port的转换,如今电脑基本上是主机字节序,存储依照小端方式,而在网络中传输统一使用大端方式,所以网络变成首先要注意字节序的转换. 一个经常使用的ip转换程序的实现: #inc ...
- win7 vs2010 安装cocos2d-x
http://blog.csdn.net/leoncoder/article/details/12523727 新安装搭建cocos2d-X的跳过这里,看以下红色開始: cocos2d-x删除vs20 ...
- [Falcor] Retrieving Multiple Values
In addition to being able to retrieve a path from a Falcor Model, you can also retrieve multiple Pat ...
- CentOS 6.6下PXE+Kickstart无人值守安装操作系统
一.简介 1.1 什么是PXE PXE(Pre-boot Execution Environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支持 ...
- 粘帖屏幕截图到web页面插件 screenshot-paste
在很多场合下,我们可能有这样的需求:提供个屏幕截图上传到系统,作为一个凭证.传统的操作方式是:屏幕截图,保存文件到本地,在web页面上选择本地文件并上传,这里至少需要三步.有没有可能直接将截图粘帖到w ...
- 用win32API 实现TextBox水印特效
demo效果:
- Hyper-V的三种网卡
External ======= 虚拟机和物理网络.本地主机都能通信 Internal ======= 虚拟机之间互相通信,并且虚拟机能和本机通信 Private ======= 仅允许运行在这台物理 ...
- (转)\r \r\n \t 的区别
小风吹雪 \r \r\n \t 的区别 http://www.360doc.com/content/12/0530/15/16538_214756101.shtml \n 软回车: 在Wi ...
- Android 如何调用自写APK和非自写APK
由于项目需要,调用一个现成的APK,总结之余,顺便把怎么调用自写APK的方法也写上,以做比较 1.如何调用现成的APK: 先上调用代码,然后再一一解释: Intent mIntent = new In ...