第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"};//有无大括号都可以

warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]

解决办法:采用第2或3种字符串赋值方式

int main(int argc, char *argv[])
{
char str[] = ""; //先把C++中的string常量复制给C语言形式的字符串变量,再将str赋值给char*形式的C语言字符串。
argv[] = str;
}

warning: ISO C++ forbids converting a string constant to 'char*'的更多相关文章

  1. warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]

    在C++中, char* p = "abc"; // valid in C, invalid in C++ 会跳出警告:warning: ISO C++ forbids conve ...

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

    warning: deprecated conversion from string constant to 'char* #include<iostream> using namespa ...

  3. deprecated conversion from string constant to ‘char*’

    deprecated conversion from string constant to ‘char*’ #include <iostream> using namespace std; ...

  4. warning:deprecated conversion from string constant to 'char *' 解决方案

    #include <iostream> using namespace std; int fuc(char *a) { cout << a << endl; } i ...

  5. warning:deprecated conversion from string constant to &#39;char *&#39;

    warning:deprecated conversion from string constant to 'char *' 解决方式 #include <iostream> using ...

  6. warning:ISO C90 forbids mixed declarations and code

    warning:ISO C90 forbids mixed declarations and code 变量定义之前不论什么一条非变量定义的语句(重视:语句是会带分号的)都会引起这个警告! 将非变量的 ...

  7. expected declaration specifiers or '...' before string constant

    /work/platform_bus_dev_drv/led_dev.c:52: error: expected declaration specifiers or '...' before stri ...

  8. ISO C90 forbids mixed declarations and code 警告

    编译的时候经常会遇到   ISO C90 forbids mixed declarations and code 警告百度了一下,知道是如下原因 : 变量定义之前任何一条非变量定义的语句(注意:语句是 ...

  9. qt ISO C++ forbids declaration of 'XXXX' with no type

    error: ISO C++ forbids declaration of 'XXXX' with no type   出现这个错误,一般是由于两个CPP相互都相互包含了对方的头文件造成的,比如: 当 ...

随机推荐

  1. Jjava8 Lambda 神操作

    public class Lambda { @FunctionalInterface public interface AddInter { void add(int x, long y); } pu ...

  2. linux学习笔记-开机流程与主引导分区(MBR)

    我的邮箱地址:zytrenren@163.com欢迎大家交流学习纠错! 读鸟哥的linux私房菜-基础学习篇(第三版)3.2.4章节作此笔记 一.术语介绍: Bios:写入到主板上的一个程序,计算机开 ...

  3. 【读书笔记】iOS-iOS流媒体

    在网络上直接看电影已经不是什么新鲜的事情,在iOS等移动设备上也有很多在线视频应用,如国内的PPS和PPLive应用,还有一些新闻视频都可以在线观看,如USA TODY.所以这些在线视频都采用流媒体技 ...

  4. vue.js 键盘enter事件的使用

    在监听键盘事件时,我们经常需要检查常见的键值.Vue 允许为 v-on 在监听键盘事件时添加按键修饰符: <!-- 只有在 `keyCode` 是 13 时调用 `vm.submit()` -- ...

  5. Tensorflow高效读取数据

    关于Tensorflow读取数据,官网给出了三种方法: 供给数据(Feeding): 在TensorFlow程序运行的每一步, 让Python代码来供给数据. 从文件读取数据: 在TensorFlow ...

  6. Power BI 与 Azure Analysis Services 的数据关联:3、还原备份文件到Azure Analysis Services

    Power BI 与 Azure  Analysis Services 的数据关联:3.还原备份文件到Azure  Analysis Services 配置存储设置 备份前,需要为服务器配置存储设置. ...

  7. Ubuntu 18 + Redis安装

    Ubuntu 18 + Redis安装 1.安装命令: opengis@gisserver20:~$ sudo apt-get install redis-server 2.查看tcp 连接 open ...

  8. Linux 学习笔记之超详细基础linux命令 Part 11

    Linux学习笔记之超详细基础linux命令 by:授客 QQ:1033553122 ---------------------------------接Part 10---------------- ...

  9. python中remove的一些坑

    前几天,使用python时遇到这么一个需求,删除一个列表中值为1的元素.我寻思着使用remove方法,但是remove方法只会删除第一个,于是我使用for循环去删除.代码和运行结果如下: 当时这个结果 ...

  10. git命令行clone指定分支、更新、冲突解决、提交代码步骤

    clone指定分支 : git init 初始化仓库 git clone -b 分支名  git@192.168.3.166:xxxx/xxxx.git   克隆指定分支 更新 :git status ...