warning:ISO C90 forbids mixed declarations and code

变量定义之前不论什么一条非变量定义的语句(重视:语句是会带分号的)都会引起这个警告!

将非变量的定义移到变量定义之后 就可以,也就是变量的声明 必须在运行语句之前。

时间: 2024-07-30 20:16:37

warning:ISO C90 forbids mixed declarations and code的相关文章

ISO C90 forbids mixed declarations and code 警告

编译的时候经常会遇到   ISO C90 forbids mixed declarations and code 警告 百度了一下,知道是如下原因 : 变量定义之前任何一条非变量定义的语句(注意:语句是会带分号的)都会引起这个警告! 解决方法: 将非变量的定义移到变量定义之后 即可 在内核中还需要将   printk的打印放在变量定义之后

warning: ISO C++ forbids converting a string constant to 'char*'

第1种字符串赋值方式: char * fileName="./2017-09-02-10-34-10.xml";//这一种字符串赋值方式已经被ISO禁止了 第2种字符串赋值方式: char str[] ="./2017-09-02-10-34-10.xml"; char *fileName=str; 第3种字符串赋值方式: char fileName[] ={"./2017-09-02-10-34-10.xml"};//有无大括号都可以 warn

ISO C++ forbids comparison between pointer and integer

在g++下编译出现ISO C++ forbids comparison between pointer and integer错误 经过检查发现错误如下: while (cin.get() !="\n") continue; 将其修改为: while (cin.get() !='\n') continue; 在ISO C++中,"\n"常量字符串比较时是使用字符串的地址,所以为char *: '\n'字符,是转换为int常量的,可以与cin.get()比较 所以出现

ISO C++ forbids declaration of * with no type

error: ISO C++ forbids declaration of 'XXXX' with no type   出现这个错误,一般是由于两个CPP相互都相互包含了对方的头文件造成的,比如: 当mainwindow.cpp.configdialog.cpp两个文件,分别包含了对方的头文件,并且分别又在自己的类中生命了对象,即: mainwindow.cpp #include "configdialog.h" class MainWindow { ConfigDialog *con

Android - Warning:Not annotated parameter overrides @NonNull parameter

Warning:Not annotated parameter overrides @NonNull parameter 本文地址:http://blog.csdn.net/caroline_wendy Warning:The @NonNull annotation can be used to indicate that a given parameter can not be null. "@NonNull"的含义是注释非空,如果出现以上警告,就表明参数应该有非空标注: 如添加:

warning:deprecated conversion from string constant to 'char *'

warning:deprecated conversion from string constant to 'char *' 解决方案 #include <iostream> using namespace std; int fuc(char *a) { cout << a << endl; } int main() { fuc("hello"); } Linux 环境下当GCC版本比较高时,编译代码可能出现的问题. 主要原因是: char * 指针

【MySQL案例】error.log的Warning:If a crash happens thisconfiguration does not guarantee that the relay lo

1.1.1. If a crash happens thisconfiguration does not guarantee that the relay log info will be consistent [环境描述] msyql5.6.14 [报错信息] mysql的slave启动时,error.log中出现Warning警告: [Warning] Slave SQL: If a crash happensthis configuration does not guarantee tha

Windows下Git使用报错:warning:LF will be replaced by CRLF in &#215;&#215;&#215;&#215;.&#215;&#215;

Windows下Git使用报错: warning:LF will be replaced by CRLF in ××××.××(文件名) The file will have its original line ending in your working directory. 翻译: 在xxx.xx文件中LF将被CRLF替换. 在工作区(working directory)里,这个文件将会保持它原本的换行符.(line ending:行尾,换行) 注解:           LF:Line F

错误: ISO C++ 不允许在类内初始化非常量静态成员

错误: ISO C++ 不允许在类内初始化非常量静态成员 今天开始学C++ primer,在牵扯到Sales_item.h头文件时,出现了一些问题(和C++11新特性相关),当前的编译器版本是gcc/g++ 4.6.3,所以需要升级.可以利用PPA升级到4.8.1,如下: sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update; sudo apt-get install gcc-4.8 g++-4.8 sud