相关疑难解决方法(0)

不推荐使用从字符串常量转换为char*错误

可能重复:
C++不推荐将字符串常量转换为'char*'

我有以下代码,虽然我没有复制完整的代码,因为它是巨大的.以下代码在模板类中,我收到如下警告.由于模板中的警告,我无法实例化它并从此处"实例化"错误.

警告:已弃用从字符串常量转换为'char*''

void ErrorMessageInRaphsodyCode(char* pcCompleteMessage, char* pcMessage, char* pcFileName, unsigned int RowNo)
{
//...
}


char cCompleteMessage[200];
memset(cCompleteMessage, 0x00, sizeof(cCompleteMessage));
char*cMessage = "add reorgenize failed";
ErrorMessageInRaphsodyCode(cCompleteMessage, cMessage, "omcollec.h", __LINE__);
Run Code Online (Sandbox Code Playgroud)

我的问题是什么是摆脱上述警告的最佳方法?

c++ coding-style compiler-warnings

3
推荐指数
2
解决办法
1万
查看次数

标签 统计

c++ ×1

coding-style ×1

compiler-warnings ×1