文章目录

  • 1. 问题描述
  • 2. 解决
  • 总结

1. 问题描述

2个cpp文件,一个.h文件,linux下编译报错

main.cpp:3:1: error: expected initializer before ‘int’

我的main.cpp编写没有问题,但是报错在main.cpp,原因是main.cpp中包含了.h文件,.h中最后一个语句没有加“;””

2. 解决

找到包含的头文件,查看是否需要加入;

总结

编写代码时注意,避免这样错误。

c语言报错(二)expected initializer before “int“相关推荐

  1. [C++报错] [Error] expected initializer before ‘Line‘

    今天在写程序时,遇到了如下问题: 报错原因:类的花括号后面没有加分号或者分号是中文的 解决方案:添加或者更改分号即可

  2. .Net Core通过NPOI在CentOS 7(Docker)环境中导出Excel报错The type initializer for ‘Gdip‘ 的问题

    一.前言 今天在AspNetCore5.0环境中做了一个导出Excel的功能,在开发机器上(windows10)调试正常,但是部署到centos7容器(容器基础环境mcr.microsoft.com/ ...

  3. react native报错:Expected a component class,got[object object]

    正在写RN的视图部分,突然模拟器报错:Expected a component class,got[object object].找也找不到原因.后来才发现是自己粗心大意造成的. 错误代码: < ...

  4. 解决Vue项目报错:Expected indentation of 2 spaces but found 4. eslint(indent) [8, 1]的方法

    解决Vue项目报错:Expected indentation of 2 spaces but found 4. eslint(indent) [8, 1]的方法 报错如下 问题分析 明显从图中可以以看 ...

  5. C语言报错:error: static declaration of xxx follows non-static declaration

    C语言报错:error: static declaration of xxx follows non-static declaration 报错原因 调用了静态函数,但没有声明 解决方案 在使用函数之 ...

  6. 读取导入csv csv报错iterable expected, not float

    示例代码 import pandas as pd import re import csv data = pd.read_csv('nuojia.csv', encoding='utf-8') # p ...

  7. Python报错“IndentationError: expected an indented block“

    问题描述: 一段python代码中使用了if name == 'main':,运行程序是报错"IndentationError: expected an indented block&quo ...

  8. DDP报错::RuntimeError: Expected all tensors to be on the same device, but found at least two devic

    DDP报错 RuntimeError: Expected all tensors to be on the same device, but found at least two devices, c ...

  9. C语言报错警告合集(转)

    C常见错误 附录1 常见错误中英文对照表 fatal error C1003: error count exceeds number; stopping compilation 中文对照:(编译错误) ...

最新文章

  1. 巧妙设置yum软件库轻松解决软件包安装问题
  2. boost::hana::keys用法的测试程序
  3. 机器学习基石(1)--The Learning Problem
  4. John the Ripper 著名密码破解工具
  5. wordpress建立数据库连接时出错
  6. HBuilderX运行微信小程序启动失败
  7. 获取必应每日一图网址
  8. MTCNN训练数据整理
  9. 应届生面试技巧心得及选择工作走向的分析
  10. EtherCAT通讯简介
  11. 兴业消费金融股份公司市场总监杜一谦:合规化进程中的消费金融探索
  12. 用C++评选优秀教师和优秀学生
  13. 【强化学习论文合集】十六.2019AAAI人工智能大会论文(AAAI2019)
  14. win10下anaconda+spyder+keras 下载与设置大全(汉化、环境变量设置、DPI缩放等)
  15. ThinkPHP的车辆租赁管理系统
  16. 《蝙蝠侠前传3:黑暗骑士崛起》蓝光高清720P 1080P 下载
  17. CJ20N/CJ11/CJ12/CJ13 - WBS屏幕增强(SMOD: CNEX0007)
  18. Android 解压Zip文件,中文乱码
  19. html字体小于12px解决方案
  20. 南京大学计算机本科培养方案,南京大学关于进一步修订本科人才培养方案和.PDF...

热门文章

  1. 5个高清图片素材网站,免费商用,赶紧收藏~
  2. 基于FPGA的数据采集—信号产生篇
  3. 无业务不技术:那些誓用区块链重塑的行业,发展怎么样了?
  4. 英语语法最终珍藏版笔记-11分词
  5. android直播切换浮窗,直播悬浮窗怎么设置
  6. PTA 天梯赛 L1-079 天梯赛的善良 (20 分) 详解
  7. 倪妮、金钟仁倾情演绎古驰2020秋冬眼镜广告形象大片
  8. iOS扫一扫功能开发
  9. 什么是 Batch normalization
  10. 使用JLink SEGGER_RTT_printf()函数实现打印浮点数