将代码从非VS转换为VS. [英] Converting code from non VS to VS

查看:89
本文介绍了将代码从非VS转换为VS.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我收到此行的错误:

Hello I getting errors for this line:

mCallName[E_ADL_Main_Control_Create] = "ADL_Main_Control_Create";

错误是:

严重级代码描述项目文件行抑制状态错误C2440'=':无法从'const char [28]'转换为'char * '

Severity Code Description Project File Line Suppression State Error C2440 '=': cannot convert from 'const char [28]' to 'char *'

代码以前是由非VS组装的,如何解决?谢谢。

Code previously was assembled by non VS, how to fix it? Thanks.

P.S。尝试过这种方法:

P.S. tried this method:

char* msz1;
strcpy(msz1, "ADL_Main_Control_Create");
mCallName[E_ADL_Main_Control_Create] = msz1;

但是收到此错误:

严重级代码描述项目文件行抑制状态错误C4996'strcpy':此函数或变量可能不安全。请考虑使用strcpy_s。要禁用弃用,请使用_CRT_SECURE_NO_WARNINGS。有关详细信息,请参阅在线帮助。

Severity Code Description Project File Line Suppression State Error C4996 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

我认为这不是一个好方法。

And I think this is not good method.

PSS试图使用strcoy_s

P.S.S. Tried to use strcoy_s

char* msz1;
strcpy_s(msz1, "ADL_Main_Control_Create");
mCallName[E_ADL_Main_Control_Create] = msz1;

但是收到此错误: 错误C2660:'strcpy_s':函数没有拿2个参数

But getting this error: error C2660: 'strcpy_s': function does not take 2 arguments

推荐答案

你好,

与msz1一样,定义错误。 strcpy必须复制到保留的内存中。您使用错误的C语法。它不应该在"非VS"中起作用。编译器也是!

as with msz1, it is defined wrong. strcpy must copy in a reserved memory. You use wrong C-Syntax. It should not have worked in "non VS" Compiler too!

char msz1[100];
strcpy(msz1, _T("ADL_Main_Control_Create"));

如果您向我们展示如何定义mCallName,我们只能帮助您使用mCallName?此外,请确保数组大小足以保持常量。那么它是如何定义的?

We can only help you with mCallName, if you show us how mCallName is defined? In addition, be sure that the array size is big enough for your constant. So how is it defined?

问候,Guido


这篇关于将代码从非VS转换为VS.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆