这种错误,一般是头文件include混乱造成的。

实例:

In file included from ftpp.h:6:0,
                    from ftpp.c:2:
parser.h:17:30: 错误:expected declaration specifiers or ‘...’ before ‘tFtpMsg’
parser.h:19:30: 错误:expected declaration specifiers or ‘...’ before ‘tFtpMsg’

parser.h:

================

#ifndef _PARSER_H_
#define _PARSER_H_

#include "ftpp.h"     //这里等于包含来自己

ftpp.h:

================

#ifndef _FTPP_H
#define _FTPP_H

#include "sockwrapper.h"
#include "common.h"
#include "parser.h"   //这里是错误包含,ftpp.h中用不到parser.h,如果ftpp.h中用到parser.h中定义到数据

//那么将parser.h中定义的部分放到ftpp.h中,

//然后将此条包含删除,避免循环包含!!!!!!!!!

#include <pthread.h>

parser.c:

================

#include "parser.h"   
#include "sockwrapper.h"
#include <string.h>

++++++++++++++++++

有一个好习惯得养成,#include "" 最好写在#include<>的上面,这样写,可以避免很多问题。

转载于:https://www.cnblogs.com/mingChou/archive/2013/01/16/wdewf.html

gcc:编译 expected declaration specifiers or ‘...’ before相关推荐

  1. 【错误笔记】error: expected declaration specifiers or '...' before XXX

    今天由于头文件的一通包含操作,导致了一个比较头疼的问题. 找了好长时间,最后删了几个头文件,才编译通过. 当 A 包含 B 的头文件,B 又包含 A 的头文件,就出现了这个神奇的 error. 错误提 ...

  2. error: expected declaration specifiers or ‘...’ before numeric constant

    今天遇到了这个错误,很奇怪,最终解决了. 可以产生这个错误的示例代码如下: #include <stdio.h>#define VALUE 1int func(int a) {printf ...

  3. 【C语言进阶】很诡异的编译报错expected declaration or statement at end of input

    作者简介 *架构师李肯(全网同名)**,一个专注于嵌入式IoT领域的架构师.有着近10年的嵌入式一线开发经验,深耕IoT领域多年,熟知IoT领域的业务发展,深度掌握IoT领域的相关技术栈,包括但不限于 ...

  4. linux gcc编译常见问题,常见gcc编译警告整理以及解决方法 - 常见gcc编译警告整理以及解决方法...

    三.常见gcc编译警告整理以及解决方法 1.warning: no newline at end of file 在文件最后一行加上回车键 解释:在<Rationale for the C99 ...

  5. C语言的error: two or more data types in declaration specifiers

    libmemcached在编译的时候,遇到错误: ./config.h:632:15: error: two or more data types in declaration specifiers# ...

  6. gcc编译出现:error: dereferencing pointer to incomplete type

    使用gcc编译c文件出现如下错误: getIP.c:14: warning: implicit declaration of function 'gethostname' getIP.c:20: wa ...

  7. 【GCC编译优化系列】宏定义名称与函数同名是一种什么骚操作?

    作者简介 *架构师李肯(全网同名)**,一个专注于嵌入式IoT领域的架构师.有着近10年的嵌入式一线开发经验,深耕IoT领域多年,熟知IoT领域的业务发展,深度掌握IoT领域的相关技术栈,包括但不限于 ...

  8. c/c++: error: expected declaration or statement at end of input

    文章目录 expected declaration or statement at end of input 和这个有点类似的警告: expected declaration or statement ...

  9. c语言conflicting types,gcc编译C程序出现”error conflicting types for function”编译错误的分析解决...

    今天使用gcc编译C语言程序时出现 "error conflicting types for function" 编译错误,这个错误的原因是什么?如何解决?以下看正文的讲解. 在使 ...

最新文章

  1. SpringBoot面试杀手锏——自动配置原理
  2. 入坑emacs之配置文件 .emas.d/init.el -v1.0
  3. 使用值类型LazyString分析字符串
  4. 沥青防水卷材行业调研报告 - 市场现状分析与发展前景预测
  5. python打印所有的水仙花数_python使用循环打印所有三位数水仙花数的实例
  6. ASP.NET OAuth 2.0 新手上路
  7. IEEE会议论文模板下载
  8. “空城计”不灵了,产城融合才有未来
  9. 翻译-你必须知道的28个HTML5特征、窍门和技术
  10. 关于const A* f(const A* pSrc,A* const pDst,int v=2,...) const throw();
  11. 【DB笔试面试758】在Oracle的DG中,Switchover和Failover的区别有哪些?
  12. 树莓派3B+安装ubuntu16.04与ROS
  13. 关于光源色温与标准光源的讨论
  14. 内存与IO,磁盘IO,网络IO
  15. debian10.7-DLBD版本安装
  16. yy神曲url解析php_php解析url并得到url中的参数及获取url参数的四种方式
  17. AI 入行那些事儿(8)人工智能 vs 人类智能
  18. 2021-11-19周赛总结
  19. 用地图说话 在商业分析与演示中运用Excel数据地图 全彩
  20. SpringBoot集成FastDFS的配合

热门文章

  1. android开发环境搭建(ubuntu15.04+jdk8+eclipse+android sdk)
  2. Centos 开放端口
  3. LeetCode Merge k Sorted Lists 解决报告
  4. Maven 连接私服资源库配置
  5. C#窗体控件-按钮控件Button
  6. SQL Server 与 SQL Express 的异同
  7. android 解决小米手机上选择照片路径为null的问题
  8. android BSP
  9. 字符编码:ASCII,Unicode(UTF-8)
  10. 使用 ArcGIS Desktop 切瓦片