小编use*_*619的帖子

C++ - 不推荐将字符串常量转换为'char*'

可能重复:
从字符串常量到char*错误的过时转换

我今天试图运行旧的C++代码(这个代码在2004年正确:).但现在我收到此错误消息:

make[1]: Entering directory `/home/thehost/Plocha/lpic-1.3.1/lpic/src'
source='error.C' object='error.o' libtool=no \
depfile='.deps/error.Po' tmpdepfile='.deps/error.TPo' \
depmode=gcc3 /bin/bash ../../config/depcomp \
g++ -DHAVE_CONFIG_H -I. -I. -I../..    -g -O2 -Wno-deprecated  -g -O2 -c -o error.o `test -f 'error.C' || echo './'`error.C
error.C: In constructor ‘error_handler::error_handler(const char*, char*)’:
error.C:49:7: error: ‘cerr’ was not declared in this scope
error.C:58:11: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-    strings]
error.C:58:11: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-    strings]
error.C:58:11: warning: deprecated conversion from string …
Run Code Online (Sandbox Code Playgroud)

c++ string char deprecated

13
推荐指数
2
解决办法
4万
查看次数

标签 统计

c++ ×1

char ×1

deprecated ×1

string ×1