从.NET 1.1升级到.NET 2.0 [英] Upgrading from .NET 1.1 to .NET 2.0

查看:81
本文介绍了从.NET 1.1升级到.NET 2.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我收到了一个用.NET 1.1上的C ++ VS.NET 2003编写的源代码项目

编译没有问题。


我在VS.NET 2005中打开了这个源代码,日志向导说

错误0和警告0.


当我尝试重新编译项目时,我收到了以下错误:


错误5错误C2065:''我':未声明的标识符c:\ Zip for

..NET\kernel\Span \TSpanning.cpp 383

错误6错误C2065:''我':未声明的标识符c:\ zip for

..net\kernel\TFile.h 154

错误7错误C2440:''初始化'':无法从''const char *''转换为

''char *''c:\ zip for .net\kernel\TFile.h 365

错误9错误C2065:''我'':未声明的标识符c :\ zip for

..net\kernel\TFile.h 154

错误10错误C2440: 'initializing'':无法从''const char *''转换为

''char *''c:\ zip for .net\kernel\TFile.h 365
错误14错误C2440:''='':无法从''const char *''转换为''char

*''c:\ Zip for .NET \\ \\ urnel \TStringUtils.cpp 195

错误25错误C2065:''我':未声明的标识符c:\ Zip for

..NET\kernel \\ \\ TFile.h 154

错误26错误C2440:''初始化'':无法从''const char *''转换为

''char *''c :\ zip for .NET\kernel\TFile.h 365

1. VS.NET 2005是不是应该与VS.NET完全兼容

2003升级项目?


2.我对C ++的了解不多,因为我是C#开发人员所以任何人都可以帮助我b / b
请帮助我如何用VS.NET 2005编译这个源代码?


感谢先进,

Asaf

Hi,

I have received a source code project written in C++ VS.NET 2003 on .NET 1.1
that compiles without a problem.

I have opened this source code in VS.NET 2005 and the Log wizard says that
Errors 0 and Warnings 0.

When trying to recompile the project I have received these errors:

Error 5 error C2065: ''i'' : undeclared identifier c:\Zip for
..NET\kernel\Span\TSpanning.cpp 383
Error 6 error C2065: ''i'' : undeclared identifier c:\zip for
..net\kernel\TFile.h 154
Error 7 error C2440: ''initializing'' : cannot convert from ''const char *'' to
''char *'' c:\zip for .net\kernel\TFile.h 365
Error 9 error C2065: ''i'' : undeclared identifier c:\zip for
..net\kernel\TFile.h 154
Error 10 error C2440: ''initializing'' : cannot convert from ''const char *'' to
''char *'' c:\zip for .net\kernel\TFile.h 365
Error 14 error C2440: ''='' : cannot convert from ''const char *'' to ''char
*'' c:\Zip for .NET\kernel\TStringUtils.cpp 195
Error 25 error C2065: ''i'' : undeclared identifier c:\Zip for
..NET\kernel\TFile.h 154
Error 26 error C2440: ''initializing'' : cannot convert from ''const char *'' to
''char *'' c:\Zip for .NET\kernel\TFile.h 365
1. Isn''t it that VS.NET 2005 supposed to be fully compatible with VS.NET
2003 projects for upgrading?

2. I have no much knowledge with C++ as I am a C# developer so can any one
please help me how to compile this source code with VS.NET 2005?

Thanks in advanced,
Asaf

推荐答案

VC2005只会转换解决方案和项目文件。

如果代码中包含的内容在VC2003中有效但不包含VC2005,(或者是
默认的构建设置已更改),则必须自行解决

。 />

例如,在我做的一个小测试项目中,我使用''array''作为

变量名。在VC2003中编译很好,在VC2005中这是一个保留的
关键字,导致很多编译错误。


似乎有一些来自const的隐式转换你的

代码中的char *到char *。如果你确定它是安全的,请检查它们并做一个明确的演员。


对于''i''未声明的标识符你必须向我们展示一些代码。


亲切的问候,

Bruno。

" Asaf" < AG ** @ newsgroups.nospam>在消息中写道

news:34 ********************************** @ microsof t.com ...
VC2005 will only convert the solution and project files.
if the code contains something that was valid in VC2003 but not VC2005, (or
default build settings that were changed), you will have to resolve that
yourself.

for example, in a small test project that i made, i used ''array'' as a
variable name. in VC2003 this compiles fine, in VC2005 this is a reserved
keyword, leading to lots of compilation errors.

it seems there are some implicit casts from const char * to char * in your
code. check them out and do an explicit cast if you determine it is safe.

for the ''i'' undeclared identifier you''d have to show us some code.

kind regards,
Bruno.
"Asaf" <AG**@newsgroups.nospam> wrote in message
news:34**********************************@microsof t.com...


我收到了一个用.NET编写的源代码项目VS.NET 2003上的
1.1
编译没有问题。

我在VS.NET 2005中打开了这个源代码,日志向导说错误0和警告0

尝试重新编译项目我收到了这些错误:

错误5错误C2065:''我':未声明的标识符c:\ Zip for
.NET \ kernel \ Span \ t \\ tTSTHning.cpp 383
错误6错误C2065:''我':未声明的标识符c:\ zip for
.net\kernel \TFile.h 154
错误7错误C2440:''初始化'':无法从''const char *''转换为
''char *''c:\ zip for .net\kernel\TFile.h 365
错误9错误C2065:''我':未声明的标识符c:\ zip
.net \ kernel \TFile.h 154
错误10错误C2440:''初始化'':无法从''const char *''转换为
''char *''c:\\ \\ zip for .net\kernel\TFile.h 365
错误14错误C2440:''='':无法从''const char *''转换为''char
*'' c:\ Zip for .NET\kernel\TStringUtils.cpp 195
错误25错误C2065:''我':未声明的标识符c:\ Zip for
.NET\kernel \\ \\ TFile.h 154
错误26错误C2440:''初始化'':无法从''const char *''转换为
''char *''c:\ Zip for .NET\kernel\TFile.h 365

1. VS.NET 2005是否应该完全兼容VS.NET
2003升级项目?

2.我对C ++知之甚少,因为我是C#开发人员,所以任何人都可以帮助我如何用VS.NET 2005编译这个源代码?

谢谢你的支持ced,
Asaf
Hi,

I have received a source code project written in C++ VS.NET 2003 on .NET
1.1
that compiles without a problem.

I have opened this source code in VS.NET 2005 and the Log wizard says that
Errors 0 and Warnings 0.

When trying to recompile the project I have received these errors:

Error 5 error C2065: ''i'' : undeclared identifier c:\Zip for
.NET\kernel\Span\TSpanning.cpp 383
Error 6 error C2065: ''i'' : undeclared identifier c:\zip for
.net\kernel\TFile.h 154
Error 7 error C2440: ''initializing'' : cannot convert from ''const char *''
to
''char *'' c:\zip for .net\kernel\TFile.h 365
Error 9 error C2065: ''i'' : undeclared identifier c:\zip for
.net\kernel\TFile.h 154
Error 10 error C2440: ''initializing'' : cannot convert from ''const char *''
to
''char *'' c:\zip for .net\kernel\TFile.h 365
Error 14 error C2440: ''='' : cannot convert from ''const char *'' to ''char
*'' c:\Zip for .NET\kernel\TStringUtils.cpp 195
Error 25 error C2065: ''i'' : undeclared identifier c:\Zip for
.NET\kernel\TFile.h 154
Error 26 error C2440: ''initializing'' : cannot convert from ''const char *''
to
''char *'' c:\Zip for .NET\kernel\TFile.h 365
1. Isn''t it that VS.NET 2005 supposed to be fully compatible with VS.NET
2003 projects for upgrading?

2. I have no much knowledge with C++ as I am a C# developer so can any one
please help me how to compile this source code with VS.NET 2005?

Thanks in advanced,
Asaf



你好布鲁诺,


感谢您的回复。


对于包含for的所有行循环我添加了int喜欢:


for(i = 0; i< EOC.TotalEntries; i ++)


for(int i = 0; i< ; EOC.TotalEntries; i ++)


因此只剩下四个错误。


对于这行:


char * psz = max(strrchr((LPCTSTR)szName,''\\''),strrchr((LPCTSTR)szName,

''/''));


我收到错误:


错误16错误C2440:''初始化'':无法转换为''const char *''

''char *''c:\ zip for .net\kernel\TFile.h 365


相同的三条线相同。

和行:

psz = max(strrchr((LPCSTR)szName,''\\''),strrchr((LPCSTR)szName, ''/''));


我收到错误:

错误26错误C2440:''='':无法转换'' const char *''to''char

*''c:\ Zip for .NET\kernel\TStri ngUtils.cpp 195



char * psz;

char szName [_MAX_DIR ];

strcpy(szName,(LPCSTR)strFileName);

psz = max(strrchr((LPCSTR)szName,''\\''),strrchr ((LPCSTR)szName,''/''));

if(psz == NULL)

{

返回PString(" ;");

}

其他

{

* psz = 0;

返回PString(szName);

}


我是C#开发人员而不是C ++所以如果你能帮助我,我将非常感激

解决了这个问题。


问候,

Asaf

" Bruno van Dooren"写道:
Hello Bruno,

Thanks for your reply.

For all the lines that contains "for" loop I have added the "int" like:

for ( i = 0; i < EOC.TotalEntries; i++ )

for (int i = 0; i < EOC.TotalEntries; i++ )

So only four errors remains.

For the line:

char* psz = max(strrchr((LPCTSTR)szName, ''\\''), strrchr((LPCTSTR)szName,
''/''));

I am reciving the error:

Error 16 error C2440: ''initializing'' : cannot convert from ''const char *'' to
''char *'' c:\zip for .net\kernel\TFile.h 365

Same for more identical three lines.
And for the line:
psz = max(strrchr((LPCSTR)szName, ''\\''), strrchr((LPCSTR)szName, ''/''));

I am receiving the error:
Error 26 error C2440: ''='' : cannot convert from ''const char *'' to ''char
*'' c:\Zip for .NET\kernel\TStringUtils.cpp 195

The line is part of:

char* psz;
char szName[_MAX_DIR];
strcpy(szName, (LPCSTR)strFileName);
psz = max(strrchr((LPCSTR)szName, ''\\''), strrchr((LPCSTR)szName, ''/''));
if(psz == NULL)
{
return PString("");
}
else
{
*psz = 0;
return PString(szName);
}

I am a C# developer not a C++ so will be much appreciated if you can help me
solve this problem.

Regards,
Asaf
"Bruno van Dooren" wrote:
VC2005只会转换解决方案和项目文件。
如果代码中包含的东西在VC2003中有效而不是VC2005,(或者
默认构建设置已更改),您必须自己解决这个问题。

例如,在我制作的一个小型测试项目中,我使用''array'作为
变量名称。在VC2003中编译很好,在VC2005中这是一个保留的
关键字,导致很多编译错误。

似乎有一些隐式的转换,从const char *到char *在你的<代码。如果你确定它是安全的,请检查它们并做一个明确的演员。

对于''我'未声明的标识符,你必须向我们展示一些代码。
亲切的问候,
Bruno。

" Asaf" < AG ** @ newsgroups.nospam>在消息中写道
新闻:34 ********************************** @ microsof t.com。 ..
VC2005 will only convert the solution and project files.
if the code contains something that was valid in VC2003 but not VC2005, (or
default build settings that were changed), you will have to resolve that
yourself.

for example, in a small test project that i made, i used ''array'' as a
variable name. in VC2003 this compiles fine, in VC2005 this is a reserved
keyword, leading to lots of compilation errors.

it seems there are some implicit casts from const char * to char * in your
code. check them out and do an explicit cast if you determine it is safe.

for the ''i'' undeclared identifier you''d have to show us some code.

kind regards,
Bruno.
"Asaf" <AG**@newsgroups.nospam> wrote in message
news:34**********************************@microsof t.com...


我收到了一个用C ++ VS.NET 2003在.NET上编写的源代码项目
1.1
编译时没有问题。

我在VS.NET 2005中打开了这个源代码,日志向导说明了错误0和警告0.

当试图重新编译时项目我收到了这些错误:

错误5错误C2065:''我':未声明的标识符c:\ Zip for
.NET\kernel \Span \TSpanning。 cpp 383
错误6错误C2065:''我':未声明的标识符c:\ zip for
.net\kernel\TFile.h 154
错误7错误C2440:' 'initializing'':无法从''const char *''转换为
''char *''c:\ zip for .net\kernel\TFile.h 365 错误9错误C2065:''我':未声明的标识符c:\ zip for
.net\kerne l\TFile.h 154
错误10错误C2440:''初始化'':无法从''const char *'转换为
''char *''c:\\ \\ zip for .net\kernel\TFile.h 365
错误14错误C2440:''='':无法从''const char *''转换为''char
*'' c:\ Zip for .NET\kernel\TStringUtils.cpp 195
错误25错误C2065:''我':未声明的标识符c:\ Zip for
.NET\kernel \\ \\ TFile.h 154
错误26错误C2440:''初始化'':无法从''const char *''转换为
''char *''c:\ Zip for .NET\kernel\TFile.h 365

1. VS.NET 2005是否应该完全兼容VS.NET
2003升级项目?

2.我对C ++知之甚少,因为我是C#开发人员,所以任何人都可以帮助我如何用VS.NET 2005编译这个源代码?

先谢谢了,
Asaf
Hi,

I have received a source code project written in C++ VS.NET 2003 on .NET
1.1
that compiles without a problem.

I have opened this source code in VS.NET 2005 and the Log wizard says that
Errors 0 and Warnings 0.

When trying to recompile the project I have received these errors:

Error 5 error C2065: ''i'' : undeclared identifier c:\Zip for
.NET\kernel\Span\TSpanning.cpp 383
Error 6 error C2065: ''i'' : undeclared identifier c:\zip for
.net\kernel\TFile.h 154
Error 7 error C2440: ''initializing'' : cannot convert from ''const char *''
to
''char *'' c:\zip for .net\kernel\TFile.h 365
Error 9 error C2065: ''i'' : undeclared identifier c:\zip for
.net\kernel\TFile.h 154
Error 10 error C2440: ''initializing'' : cannot convert from ''const char *''
to
''char *'' c:\zip for .net\kernel\TFile.h 365
Error 14 error C2440: ''='' : cannot convert from ''const char *'' to ''char
*'' c:\Zip for .NET\kernel\TStringUtils.cpp 195
Error 25 error C2065: ''i'' : undeclared identifier c:\Zip for
.NET\kernel\TFile.h 154
Error 26 error C2440: ''initializing'' : cannot convert from ''const char *''
to
''char *'' c:\Zip for .NET\kernel\TFile.h 365
1. Isn''t it that VS.NET 2005 supposed to be fully compatible with VS.NET
2003 projects for upgrading?

2. I have no much knowledge with C++ as I am a C# developer so can any one
please help me how to compile this source code with VS.NET 2005?

Thanks in advanced,
Asaf




在你的情况下,使用强制转换摆脱const
限定符。

char * psz =(char *)max(strrchr((LPCTSTR)szName,''\\''),

strrchr((LPCTSTR)szName,''/''));


max宏返回一个const char *,因为这是strrchr返回的结果

在这种情况下。

因为你已经知道缓冲区不是const(它是你自己的缓冲区)

将const转换掉是安全的。


亲切的问候,

布鲁诺。


" Asaf" < AG ** @ newsgroups.nospam>在消息中写道

news:85 ********************************** @ microsof t.com ...
In your case it is perfectly safe to use a cast to get rid of the const
qualifier.
char* psz = (char *) max(strrchr((LPCTSTR)szName, ''\\''),
strrchr((LPCTSTR)szName, ''/''));

the max macro returns a const char *, because that is what strrchr returns
in this case.
since you already know that the buffer is not const (it is your own buffer)
it is safe to cast the const away.

kind regards,
Bruno.

"Asaf" <AG**@newsgroups.nospam> wrote in message
news:85**********************************@microsof t.com...
Hello Bruno,

感谢您的回复。

对于包含for的所有行循环我添加了int例如:

for(i = 0; i< EOC.TotalEntries; i ++)
for(int i = 0; i< EOC.TotalEntries; i ++)

因此只剩下四个错误。

对于这一行:

char * psz = max(strrchr((LPCTSTR)szName,''\ \''),strrchr((LPCTSTR)szName,
''/''));

我正在收到错误:

错误16错误C2440:''初始化'':无法从''const char *''转换为
''char *''c:\ zip for .net\kernel\TFile.h 365

相同的三行相同。

和行:
psz = max(strrchr((LPCSTR)szName,''\\' '),strrchr((LPCSTR)szName,''/''));

我收到错误:
错误26错误C2440:''='':无法转换自''const char *''to''char
*''c:\ zip for .NET\kernel\TStringUtils.cpp 195

该行是其中一部分:

char * psz;
char szName [_MAX_DIR];
strcpy(szName,(LPCSTR)strFileName);
psz = max(strrchr((LPCSTR)szName,''\\''),strrchr( (LPCSTR)szName,''/''));
if(psz == NULL)
{
返回PString("");
} 其他
{
* psz = 0;
返回PString(szName);
}

我是C#开发人员,不是C ++,所以将是非常感谢,如果你能帮助

解决这个问题。

问候,
Asaf

" Bruno van Dooren"写道:
Hello Bruno,

Thanks for your reply.

For all the lines that contains "for" loop I have added the "int" like:

for ( i = 0; i < EOC.TotalEntries; i++ )

for (int i = 0; i < EOC.TotalEntries; i++ )

So only four errors remains.

For the line:

char* psz = max(strrchr((LPCTSTR)szName, ''\\''), strrchr((LPCTSTR)szName,
''/''));

I am reciving the error:

Error 16 error C2440: ''initializing'' : cannot convert from ''const char *''
to
''char *'' c:\zip for .net\kernel\TFile.h 365

Same for more identical three lines.
And for the line:
psz = max(strrchr((LPCSTR)szName, ''\\''), strrchr((LPCSTR)szName, ''/''));

I am receiving the error:
Error 26 error C2440: ''='' : cannot convert from ''const char *'' to ''char
*'' c:\Zip for .NET\kernel\TStringUtils.cpp 195

The line is part of:

char* psz;
char szName[_MAX_DIR];
strcpy(szName, (LPCSTR)strFileName);
psz = max(strrchr((LPCSTR)szName, ''\\''), strrchr((LPCSTR)szName, ''/''));
if(psz == NULL)
{
return PString("");
}
else
{
*psz = 0;
return PString(szName);
}

I am a C# developer not a C++ so will be much appreciated if you can help
me
solve this problem.

Regards,
Asaf
"Bruno van Dooren" wrote:
VC2005只会转换解决方案和项目文件。
如果代码中包含的内容在VC2003中有效,但不包含VC2005,
(或
默认的构建设置已更改),你必须自己解决这个问题。

例如,在我做的一个小测试项目中,我使用''array''作为变量名称。在VC2003中编译很好,在VC2005中这是一个保留的
关键字,导致很多编译错误。

似乎有一些隐式的转换,从const char *到char * in 代码。如果你确定它是安全的,请检查它们并做一个明确的演员。

对于''我'未声明的标识符,你必须向我们展示一些代码。
亲切的问候,
Bruno。

" Asaf" < AG ** @ newsgroups.nospam>在消息中写道
新闻:34 ********************************** @ microsof t.com。 ..
VC2005 will only convert the solution and project files.
if the code contains something that was valid in VC2003 but not VC2005,
(or
default build settings that were changed), you will have to resolve that
yourself.

for example, in a small test project that i made, i used ''array'' as a
variable name. in VC2003 this compiles fine, in VC2005 this is a reserved
keyword, leading to lots of compilation errors.

it seems there are some implicit casts from const char * to char * in
your
code. check them out and do an explicit cast if you determine it is safe.

for the ''i'' undeclared identifier you''d have to show us some code.

kind regards,
Bruno.
"Asaf" <AG**@newsgroups.nospam> wrote in message
news:34**********************************@microsof t.com...
>
>
>我收到了一个用C ++ VS.NET 2003编写的源代码项目
> .NET
> 1.1
>编译没有问题。
>
>我在VS.NET 2005中打开了这个源代码,日志向导说
>
>错误0和警告0.
>
>尝试重新编译项目时,我收到了以下错误:
>
>错误5错误C2065:''我':未声明的标识符c:\ Zip for
> .NET.\\kernel\Span\TSpanning.cpp 383
>错误6错误C2065:''我':未声明的标识符c:\ zip for
> .net\kernel\TFile.h 154
>错误7错误C2440:''初始化'':无法转换为''const char
> *''
>到
> ''char *''c:\ zip for .net\kernel\TFile.h 365
>错误9错误C2065:''我':未声明的标识符c:\ zip for
> .net\kernel\TFile.h 154
>错误10错误C2440:''初始化'':无法转换为''const char
> *''
>到
> ''char *''c:\ zip for .net\kernel\TFile.h 365
>错误14错误C2440:''='':无法从''const char *''转换为''char
> *''c:\ Zip for .NET\kernel\TStringUtils.cpp 195
>错误25错误C2065:''我':未声明的标识符c:\ Zip for
> .NET \ kernel \TFile.h 154
>错误26错误C2440:''初始化'':无法转换为''const char
> *''
>到
> ''char *''c:\ Zip for .NET\kernel\TFile.h 365
>
>
> 1. VS.NET 2005应该与
>完全兼容吗? VS.NET
> 2003升级项目?
>
> 2.我对C ++知之甚少,因为我是C#开发人员,所以任何
>一个
>请帮我看看如何用VS.NET 2005编译这个源代码?
>
>感谢先进,
> Asaf
>
> Hi,
>
> I have received a source code project written in C++ VS.NET 2003 on
> .NET
> 1.1
> that compiles without a problem.
>
> I have opened this source code in VS.NET 2005 and the Log wizard says
> that
> Errors 0 and Warnings 0.
>
> When trying to recompile the project I have received these errors:
>
> Error 5 error C2065: ''i'' : undeclared identifier c:\Zip for
> .NET\kernel\Span\TSpanning.cpp 383
> Error 6 error C2065: ''i'' : undeclared identifier c:\zip for
> .net\kernel\TFile.h 154
> Error 7 error C2440: ''initializing'' : cannot convert from ''const char
> *''
> to
> ''char *'' c:\zip for .net\kernel\TFile.h 365
> Error 9 error C2065: ''i'' : undeclared identifier c:\zip for
> .net\kernel\TFile.h 154
> Error 10 error C2440: ''initializing'' : cannot convert from ''const char
> *''
> to
> ''char *'' c:\zip for .net\kernel\TFile.h 365
> Error 14 error C2440: ''='' : cannot convert from ''const char *'' to ''char
> *'' c:\Zip for .NET\kernel\TStringUtils.cpp 195
> Error 25 error C2065: ''i'' : undeclared identifier c:\Zip for
> .NET\kernel\TFile.h 154
> Error 26 error C2440: ''initializing'' : cannot convert from ''const char
> *''
> to
> ''char *'' c:\Zip for .NET\kernel\TFile.h 365
>
>
> 1. Isn''t it that VS.NET 2005 supposed to be fully compatible with
> VS.NET
> 2003 projects for upgrading?
>
> 2. I have no much knowledge with C++ as I am a C# developer so can any
> one
> please help me how to compile this source code with VS.NET 2005?
>
> Thanks in advanced,
> Asaf
>




这篇关于从.NET 1.1升级到.NET 2.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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