Upgrading from .NET 1.1 to .NET 2.0

G

Guest

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
 
B

Bruno van Dooren

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.
 
G

Guest

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
 
B

Bruno van Dooren

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 said:
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 said:
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.
 
G

Guest

Hello Bruno,

Now when trying to compile the solution I am receiving the error:

Error 121 Command line error D8045 : cannot compile C file
'.\kernel\Zip\win32\win32zip.c' with the /clr option cl

Is there other switch I can set on the file so it will compile with VS.NET
2005?

Regards,
Asaf


Bruno van Dooren said:
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 said:
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 said:
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.


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
 
B

Bruno van Dooren

if you right-click the file in your solution window, then under
configuration properties -> C/C++ ->Advanced
you can set the option 'Compile as' to C++.

that will cause VC2005 to compile it as a C++ file instead of a C file.

kind regards,
Bruno.


Asaf said:
Hello Bruno,

Now when trying to compile the solution I am receiving the error:

Error 121 Command line error D8045 : cannot compile C file
'.\kernel\Zip\win32\win32zip.c' with the /clr option cl

Is there other switch I can set on the file so it will compile with VS.NET
2005?

Regards,
Asaf


Bruno van Dooren said:
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 said:
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


:

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.


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
 
G

Guest

Hello Bruno,

After setting the file to compile with C++ the compilation for that file
results in about 34 errors.

Any thing else that can solve this problem please?

Regards,
Asaf


Bruno van Dooren said:
if you right-click the file in your solution window, then under
configuration properties -> C/C++ ->Advanced
you can set the option 'Compile as' to C++.

that will cause VC2005 to compile it as a C++ file instead of a C file.

kind regards,
Bruno.


Asaf said:
Hello Bruno,

Now when trying to compile the solution I am receiving the error:

Error 121 Command line error D8045 : cannot compile C file
'.\kernel\Zip\win32\win32zip.c' with the /clr option cl

Is there other switch I can set on the file so it will compile with VS.NET
2005?

Regards,
Asaf


Bruno van Dooren said:
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.





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


:

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.


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
 
D

David Wilkinson

Asaf said:
Hello Bruno,

After setting the file to compile with C++ the compilation for that file
results in about 34 errors.

Any thing else that can solve this problem please?

Regards,
Asaf

Asaf:

When you get an error, look up the Cxxxx error number in the help.
Usually you will be able to tell that your code as not really correct
before, but the older compiler allowed it.

Personally, I think testing code with a new or different compiler is a
lot of fun. It's very little effort, and you end up with better code. In
most cases you can take the modified code back to the old compiler and
it will work (perhaps better than before, because before it really had
bugs).

Do not look on these compiler warnings as a bad thing; they are good. If
the compilers treated all your code the same, then there would really be
not much point in upgrading (at least from the viewpoint of unmanaged
code).

David Wilkinson
 
B

Bruno van Dooren

compile it as C code, but set configuration properties -> c/c++ ->
general -> compile as managed
to 'not using managed extensions'.

but that might lead to other problems because you will be working with mixed
mode code. not knowing the structure of your project makes it very difficult
to say anything useful at this point.

kind regards,
Bruno.


Asaf said:
Hello Bruno,

After setting the file to compile with C++ the compilation for that file
results in about 34 errors.

Any thing else that can solve this problem please?

Regards,
Asaf


Bruno van Dooren said:
if you right-click the file in your solution window, then under
configuration properties -> C/C++ ->Advanced
you can set the option 'Compile as' to C++.

that will cause VC2005 to compile it as a C++ file instead of a C file.

kind regards,
Bruno.


Asaf said:
Hello Bruno,

Now when trying to compile the solution I am receiving the error:

Error 121 Command line error D8045 : cannot compile C file
'.\kernel\Zip\win32\win32zip.c' with the /clr option cl

Is there other switch I can set on the file so it will compile with
VS.NET
2005?

Regards,
Asaf


:

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.





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


:

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.


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
 
G

Guest

Hello Bruno,

I give up! Nothing is working to compile this project :(
Too bad that Microsoft does not preserve compatibility between VS.NET 2003 &
VS.NET 2005.
Any way, thanks for your time & share of knowledge.

Regards,
Asaf


Bruno van Dooren said:
compile it as C code, but set configuration properties -> c/c++ ->
general -> compile as managed
to 'not using managed extensions'.

but that might lead to other problems because you will be working with mixed
mode code. not knowing the structure of your project makes it very difficult
to say anything useful at this point.

kind regards,
Bruno.


Asaf said:
Hello Bruno,

After setting the file to compile with C++ the compilation for that file
results in about 34 errors.

Any thing else that can solve this problem please?

Regards,
Asaf


Bruno van Dooren said:
if you right-click the file in your solution window, then under
configuration properties -> C/C++ ->Advanced
you can set the option 'Compile as' to C++.

that will cause VC2005 to compile it as a C++ file instead of a C file.

kind regards,
Bruno.


Hello Bruno,

Now when trying to compile the solution I am receiving the error:

Error 121 Command line error D8045 : cannot compile C file
'.\kernel\Zip\win32\win32zip.c' with the /clr option cl

Is there other switch I can set on the file so it will compile with
VS.NET
2005?

Regards,
Asaf


:

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.





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


:

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.


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
 
W

Willy Denoyette [MVP]

The /clr flag is only valid for C++, so you should turn of this flag to
compile .c files. I don't get it that this project compiled with VS2003 as
this requirement didn't change.

Willy.



| Hello Bruno,
|
| After setting the file to compile with C++ the compilation for that file
| results in about 34 errors.
|
| Any thing else that can solve this problem please?
|
| Regards,
| Asaf
|
|
| "Bruno van Dooren" wrote:
|
| > if you right-click the file in your solution window, then under
| > configuration properties -> C/C++ ->Advanced
| > you can set the option 'Compile as' to C++.
| >
| > that will cause VC2005 to compile it as a C++ file instead of a C file.
| >
| > kind regards,
| > Bruno.
| >
| >
| > | > > Hello Bruno,
| > >
| > > Now when trying to compile the solution I am receiving the error:
| > >
| > > Error 121 Command line error D8045 : cannot compile C file
| > > '.\kernel\Zip\win32\win32zip.c' with the /clr option cl
| > >
| > > Is there other switch I can set on the file so it will compile with
VS.NET
| > > 2005?
| > >
| > > Regards,
| > > Asaf
| > >
| > >
| > > "Bruno van Dooren" wrote:
| > >
| > >> 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.
| > >>
| > >>
| > >>
| > >>
| > >>
| > >> | > >> > 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 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.
| > >> >>
| > >> >>
| > >> >> | > >> >> > 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
| > >> >> >
| > >> >>
| > >> >>
| > >> >>
| > >>
| > >>
| > >>
| >
| >
| >
 
G

Guest

Hi,

I have finally been able to compile the code for making a release Assembly
but I have left with to questions.

1. When trying to compile for release I have got the error:

Command line error D8016 : '/MT' and '/clr:blush:ldsyntax' command-line options
are incompatible
So I switched it to: Multi-threaded DLL (/MD) for the C\C++ -> Code
Generation -> Runtime Library.

Is that ok?

2. After compile I am receiving the error:

Error 546 error AL1019: Metadata failure while creating assembly -- The
process cannot access the file because it is being used by another process.
ALINK

But the Assembly is working ok, so do I need to worry about this error?

Regards,
Asaf


Willy Denoyette said:
The /clr flag is only valid for C++, so you should turn of this flag to
compile .c files. I don't get it that this project compiled with VS2003 as
this requirement didn't change.

Willy.



| Hello Bruno,
|
| After setting the file to compile with C++ the compilation for that file
| results in about 34 errors.
|
| Any thing else that can solve this problem please?
|
| Regards,
| Asaf
|
|
| "Bruno van Dooren" wrote:
|
| > if you right-click the file in your solution window, then under
| > configuration properties -> C/C++ ->Advanced
| > you can set the option 'Compile as' to C++.
| >
| > that will cause VC2005 to compile it as a C++ file instead of a C file.
| >
| > kind regards,
| > Bruno.
| >
| >
| > | > > Hello Bruno,
| > >
| > > Now when trying to compile the solution I am receiving the error:
| > >
| > > Error 121 Command line error D8045 : cannot compile C file
| > > '.\kernel\Zip\win32\win32zip.c' with the /clr option cl
| > >
| > > Is there other switch I can set on the file so it will compile with
VS.NET
| > > 2005?
| > >
| > > Regards,
| > > Asaf
| > >
| > >
| > > "Bruno van Dooren" wrote:
| > >
| > >> 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.
| > >>
| > >>
| > >>
| > >>
| > >>
| > >> | > >> > 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 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.
| > >> >>
| > >> >>
| > >> >> | > >> >> > 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
| > >> >> >
| > >> >>
| > >> >>
| > >> >>
| > >>
| > >>
| > >>
| >
| >
| >
 
B

Bruno van Dooren

Hello,
1. When trying to compile for release I have got the error:

Command line error D8016 : '/MT' and '/clr:blush:ldsyntax' command-line options
are incompatible
So I switched it to: Multi-threaded DLL (/MD) for the C\C++ -> Code
Generation -> Runtime Library.

Is that ok?

from MSDN:
a.. The following compiler options are not supported with /clr:

a.. /EHsc and /EHs (/clr implies /EHa (see /EH (Exception Handling Model))

b.. /fp:strict and /fp:except (see /fp (Specify Floating-Point
Behavior).)/Zd

c.. /Gm

d.. /MT

e.. /RTC

f.. /ZI

/MD is not in the list, so that is fine.

2. After compile I am receiving the error:

Error 546 error AL1019: Metadata failure while creating assembly -- The
process cannot access the file because it is being used by another
process.
ALINK

But the Assembly is working ok, so do I need to worry about this error?
you don't have a resource file open for editing, or something like that?
try to close VS2005 completely, then reopen your project, make sure all
resource editing windows are closed, and then do a complete rebuild.
if that doesn't solve it, try to find out which files al is trying to
access. that might also give you some clues as to what is going on.

kind regards,
Bruno.


Regards,
Asaf


Willy Denoyette said:
The /clr flag is only valid for C++, so you should turn of this flag to
compile .c files. I don't get it that this project compiled with VS2003
as
this requirement didn't change.

Willy.



| Hello Bruno,
|
| After setting the file to compile with C++ the compilation for that
file
| results in about 34 errors.
|
| Any thing else that can solve this problem please?
|
| Regards,
| Asaf
|
|
| "Bruno van Dooren" wrote:
|
| > if you right-click the file in your solution window, then under
| > configuration properties -> C/C++ ->Advanced
| > you can set the option 'Compile as' to C++.
| >
| > that will cause VC2005 to compile it as a C++ file instead of a C
file.
| >
| > kind regards,
| > Bruno.
| >
| >
| > | > > Hello Bruno,
| > >
| > > Now when trying to compile the solution I am receiving the error:
| > >
| > > Error 121 Command line error D8045 : cannot compile C file
| > > '.\kernel\Zip\win32\win32zip.c' with the /clr option cl
| > >
| > > Is there other switch I can set on the file so it will compile with
VS.NET
| > > 2005?
| > >
| > > Regards,
| > > Asaf
| > >
| > >
| > > "Bruno van Dooren" wrote:
| > >
| > >> 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.
| > >>
| > >>
| > >>
| > >>
| > >>
| > >> | > >> > 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 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.
| > >> >>
| > >> >>
| > >> >> | > >> >> > 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
| > >> >> >
| > >> >>
| > >> >>
| > >> >>
| > >>
| > >>
| > >>
| >
| >
| >
 
G

Guest

Hi,

It is compile ok but with warning:

general warning 810100b3: .\Release\MyProject.dll is a strong-name signed
assembly and embedding a manifest invalidates the signature. You will need to
re-sign this file to make it a valid assembly. File: mt.exe

In the solution explorer there is a key.snk

When trying to run my application in other machine it does not work because
of an error with the key.

Is there a way to compile it without this key or other way to compile?

Regards,
Asaf


Bruno van Dooren said:
Hello,
1. When trying to compile for release I have got the error:

Command line error D8016 : '/MT' and '/clr:blush:ldsyntax' command-line options
are incompatible
So I switched it to: Multi-threaded DLL (/MD) for the C\C++ -> Code
Generation -> Runtime Library.

Is that ok?

from MSDN:
a.. The following compiler options are not supported with /clr:

a.. /EHsc and /EHs (/clr implies /EHa (see /EH (Exception Handling Model))

b.. /fp:strict and /fp:except (see /fp (Specify Floating-Point
Behavior).)/Zd

c.. /Gm

d.. /MT

e.. /RTC

f.. /ZI

/MD is not in the list, so that is fine.

2. After compile I am receiving the error:

Error 546 error AL1019: Metadata failure while creating assembly -- The
process cannot access the file because it is being used by another
process.
ALINK

But the Assembly is working ok, so do I need to worry about this error?
you don't have a resource file open for editing, or something like that?
try to close VS2005 completely, then reopen your project, make sure all
resource editing windows are closed, and then do a complete rebuild.
if that doesn't solve it, try to find out which files al is trying to
access. that might also give you some clues as to what is going on.

kind regards,
Bruno.


Regards,
Asaf


Willy Denoyette said:
The /clr flag is only valid for C++, so you should turn of this flag to
compile .c files. I don't get it that this project compiled with VS2003
as
this requirement didn't change.

Willy.



| Hello Bruno,
|
| After setting the file to compile with C++ the compilation for that
file
| results in about 34 errors.
|
| Any thing else that can solve this problem please?
|
| Regards,
| Asaf
|
|
| "Bruno van Dooren" wrote:
|
| > if you right-click the file in your solution window, then under
| > configuration properties -> C/C++ ->Advanced
| > you can set the option 'Compile as' to C++.
| >
| > that will cause VC2005 to compile it as a C++ file instead of a C
file.
| >
| > kind regards,
| > Bruno.
| >
| >
| > | > > Hello Bruno,
| > >
| > > Now when trying to compile the solution I am receiving the error:
| > >
| > > Error 121 Command line error D8045 : cannot compile C file
| > > '.\kernel\Zip\win32\win32zip.c' with the /clr option cl
| > >
| > > Is there other switch I can set on the file so it will compile with
VS.NET
| > > 2005?
| > >
| > > Regards,
| > > Asaf
| > >
| > >
| > > "Bruno van Dooren" wrote:
| > >
| > >> 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.
| > >>
| > >>
| > >>
| > >>
| > >>
| > >> | > >> > 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 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.
| > >> >>
| > >> >>
| > >> >> | > >> >> > 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
 
B

Bruno van Dooren

you can use sn.exe to re-sign the assembly. check out Sn.exe in MSDN.

also, if you run your app on computers that do not have VC2005 installed,
you have to distribute the msvc80 runtime dlls with your application.

kind regards,
Bruno.


Asaf said:
Hi,

It is compile ok but with warning:

general warning 810100b3: .\Release\MyProject.dll is a strong-name signed
assembly and embedding a manifest invalidates the signature. You will need
to
re-sign this file to make it a valid assembly. File: mt.exe

In the solution explorer there is a key.snk

When trying to run my application in other machine it does not work
because
of an error with the key.

Is there a way to compile it without this key or other way to compile?

Regards,
Asaf


Bruno van Dooren said:
Hello,
1. When trying to compile for release I have got the error:

Command line error D8016 : '/MT' and '/clr:blush:ldsyntax' command-line
options
are incompatible
So I switched it to: Multi-threaded DLL (/MD) for the C\C++ -> Code
Generation -> Runtime Library.

Is that ok?

from MSDN:
a.. The following compiler options are not supported with /clr:

a.. /EHsc and /EHs (/clr implies /EHa (see /EH (Exception Handling
Model))

b.. /fp:strict and /fp:except (see /fp (Specify Floating-Point
Behavior).)/Zd

c.. /Gm

d.. /MT

e.. /RTC

f.. /ZI

/MD is not in the list, so that is fine.

2. After compile I am receiving the error:

Error 546 error AL1019: Metadata failure while creating assembly -- The
process cannot access the file because it is being used by another
process.
ALINK

But the Assembly is working ok, so do I need to worry about this error?
you don't have a resource file open for editing, or something like that?
try to close VS2005 completely, then reopen your project, make sure all
resource editing windows are closed, and then do a complete rebuild.
if that doesn't solve it, try to find out which files al is trying to
access. that might also give you some clues as to what is going on.

kind regards,
Bruno.


Regards,
Asaf


:

The /clr flag is only valid for C++, so you should turn of this flag
to
compile .c files. I don't get it that this project compiled with
VS2003
as
this requirement didn't change.

Willy.



| Hello Bruno,
|
| After setting the file to compile with C++ the compilation for that
file
| results in about 34 errors.
|
| Any thing else that can solve this problem please?
|
| Regards,
| Asaf
|
|
| "Bruno van Dooren" wrote:
|
| > if you right-click the file in your solution window, then under
| > configuration properties -> C/C++ ->Advanced
| > you can set the option 'Compile as' to C++.
| >
| > that will cause VC2005 to compile it as a C++ file instead of a C
file.
| >
| > kind regards,
| > Bruno.
| >
| >
| > | > > Hello Bruno,
| > >
| > > Now when trying to compile the solution I am receiving the
error:
| > >
| > > Error 121 Command line error D8045 : cannot compile C file
| > > '.\kernel\Zip\win32\win32zip.c' with the /clr option cl
| > >
| > > Is there other switch I can set on the file so it will compile
with
VS.NET
| > > 2005?
| > >
| > > Regards,
| > > Asaf
| > >
| > >
| > > "Bruno van Dooren" wrote:
| > >
| > >> 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.
| > >>
| > >>
| > >>
| > >>
| > >>
| > >> | > >> > 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 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.
| > >> >>
| > >> >>
| > >> >> | > >> >> > 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
 
G

Guest

Hello Bruno,

Thanks to you I am able to compile the assembly and it is working on other
machines without a problem.

Many thanks for your time & support :)

Regards,
Asaf


Bruno van Dooren said:
you can use sn.exe to re-sign the assembly. check out Sn.exe in MSDN.

also, if you run your app on computers that do not have VC2005 installed,
you have to distribute the msvc80 runtime dlls with your application.

kind regards,
Bruno.


Asaf said:
Hi,

It is compile ok but with warning:

general warning 810100b3: .\Release\MyProject.dll is a strong-name signed
assembly and embedding a manifest invalidates the signature. You will need
to
re-sign this file to make it a valid assembly. File: mt.exe

In the solution explorer there is a key.snk

When trying to run my application in other machine it does not work
because
of an error with the key.

Is there a way to compile it without this key or other way to compile?

Regards,
Asaf


Bruno van Dooren said:
Hello,

1. When trying to compile for release I have got the error:

Command line error D8016 : '/MT' and '/clr:blush:ldsyntax' command-line
options
are incompatible
So I switched it to: Multi-threaded DLL (/MD) for the C\C++ -> Code
Generation -> Runtime Library.

Is that ok?

from MSDN:
a.. The following compiler options are not supported with /clr:

a.. /EHsc and /EHs (/clr implies /EHa (see /EH (Exception Handling
Model))

b.. /fp:strict and /fp:except (see /fp (Specify Floating-Point
Behavior).)/Zd

c.. /Gm

d.. /MT

e.. /RTC

f.. /ZI

/MD is not in the list, so that is fine.



2. After compile I am receiving the error:

Error 546 error AL1019: Metadata failure while creating assembly -- The
process cannot access the file because it is being used by another
process.
ALINK

But the Assembly is working ok, so do I need to worry about this error?
you don't have a resource file open for editing, or something like that?
try to close VS2005 completely, then reopen your project, make sure all
resource editing windows are closed, and then do a complete rebuild.
if that doesn't solve it, try to find out which files al is trying to
access. that might also give you some clues as to what is going on.

kind regards,
Bruno.




Regards,
Asaf


:

The /clr flag is only valid for C++, so you should turn of this flag
to
compile .c files. I don't get it that this project compiled with
VS2003
as
this requirement didn't change.

Willy.



| Hello Bruno,
|
| After setting the file to compile with C++ the compilation for that
file
| results in about 34 errors.
|
| Any thing else that can solve this problem please?
|
| Regards,
| Asaf
|
|
| "Bruno van Dooren" wrote:
|
| > if you right-click the file in your solution window, then under
| > configuration properties -> C/C++ ->Advanced
| > you can set the option 'Compile as' to C++.
| >
| > that will cause VC2005 to compile it as a C++ file instead of a C
file.
| >
| > kind regards,
| > Bruno.
| >
| >
| > | > > Hello Bruno,
| > >
| > > Now when trying to compile the solution I am receiving the
error:
| > >
| > > Error 121 Command line error D8045 : cannot compile C file
| > > '.\kernel\Zip\win32\win32zip.c' with the /clr option cl
| > >
| > > Is there other switch I can set on the file so it will compile
with
VS.NET
| > > 2005?
| > >
| > > Regards,
| > > Asaf
| > >
| > >
| > > "Bruno van Dooren" wrote:
| > >
| > >> 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.
| > >>
| > >>
| > >>
| > >>
| > >>
| > >> | > >> > 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 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.
| > >> >>
| > >> >>
| > >> >> | > >> >> > Hi,
| > >> >> >
| > >> >> > I have received a source code project written in C++
VS.NET
2003
on
| > >> >> > .NET
| > >> >> > 1.1
| > >> >> > that compiles without a problem.
| > >> >> >
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top