arm linux c++编译警告:ISO C++ forbids converting a string constant to ‘char*’(需要把const char*转换成char*)
生活随笔
收集整理的這篇文章主要介紹了
arm linux c++编译警告:ISO C++ forbids converting a string constant to ‘char*’(需要把const char*转换成char*)
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
編譯時遇到警告:
只是因為這兩句代碼:
char *output_file = NULL; output_file = "./shortVideo.mp4";但是后面?zhèn)魅牒瘮?shù)的時候確實需要一個void*而不是const void*,
解決辦法:將output_file的const char*類型轉換成char*類型
char *output_file = (char*)"./shortVideo.mp4";參考文章:linux 環(huán)境下:warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
總結
以上是生活随笔為你收集整理的arm linux c++编译警告:ISO C++ forbids converting a string constant to ‘char*’(需要把const char*转换成char*)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 编译器编译报错时aka是什么意思?(al
- 下一篇: c++中结构体套结构体用 = {0}初始