Works in Visual C++ 2003 but not in 2005



Hi,

I am working on a C++ project which has been developed with Visual
Studio.Net 2003. When I compile it with Visual Studio 2005, it gives hundred
of errors. Two of the strange errors are following, which repeated in many
places:

1-error C2664: 'action' : cannot convert parameter 1 from 'Foo *' to 'const
Foo *&'

2-error C2248: 'std::vector<_Ty>::_Myfirst' : cannot access protected member
declared in class 'std::vector<_Ty>'
with
[
_Ty=oid
]
------------------

Borland C++Builder compiles the same code without any error! What's wrong
with Visual Studio 2005?
Does any body know what's the problem and how to fix it? I'd appreciate any
help.

Here is a simple test program to show the error:

// -- CPPConstTest1.cpp

class Foo{
public:
Foo();
private:
int index;
};

void action(const Foo*& cptr);

int main()
{

Foo* fPtr = new Foo();
action(fPtr);

return 0;
} // end of main
//---------------------------
Foo::Foo(){
index=0;
}
//----------------
void action(const Foo*& cptr){

}
//---------------------- Build Output with Visual Studio
2005: ---------------------
------ Build started: Project: CPPTestVS05, Configuration: Debug
Win32 ------
Compiling...
CPPConstTest1.cpp
..\CPPConstTest1.cpp(17) : error C2664: 'action' : cannot convert parameter 1
from 'Foo *' to 'const Foo *&'
Conversion loses qualifiers
CPPTestVS05 - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



.



Relevant Pages

  • Re: Is DEFCONSTANT broken?
    ... (defconstant foo ...) ... If you compile a file containing defconstant which is used in that file, ... defconstant overcomes the externalizeability problem by externalizing the ...
    (comp.lang.lisp)
  • Re: Whats up with Scheme macros?
    ... which is NOT part of the spec for defmacro: ... might be effectively a bug in the spec since it really ... there is an issue because (foo) is in a context where the definition inline ... But the value of x is needed at compile time, ...
    (comp.lang.lisp)
  • Re: Is Double Dispatch really object-oriented?
    ... Compile error, in a language that supports MD properly => ... No dispatch ever fails ... Do you seriously claim that you can test Foo having just one B? ...
    (comp.object)
  • Re: Upgraded Web Service from VS2003 to VS2005 and all Hell breaks
    ... Visual Studio 2005 Web Application Projects ... "Because the Web Application Project model uses the same conceptual ... My web service project doesn't even have a bin folder. ... When I compile in batch from Visual Build Pro, ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: Whats up with Scheme macros?
    ... Because the binding has to happen at a known time so the init form ... (defmacro foo () ... At compile time? ... it were to follow what DEFUN does. ...
    (comp.lang.lisp)