Put Method and Visual C++ .Net

Giganews Newsgroups
Subject: Put Method and Visual C++ .Net
Posted by:  Alvin Ho (alvin.…@background2.co.uk)
Date: Mon, 2 Jan 2006

Hi there,

I'm currently implementing Indy FTP in Visual C++, and have encountered a peculiar problem.

Whenever I try to implement the Put(String source, String destination, bool Append) method passing String references, the compiler throws the following errors:

c:\PetrolAppProject\FTPObjects.cpp(101): error C2535: 'void Indy::Sockets::TIdNetStream::WriteBuffer(double,int)' : member function already defined or declared
c:\PetrolAppProject\FTPObjects.cpp(101): error C2084: function 'int Indy::Sockets::TIdNetStream::Read(double __gc *)' already has a body
c:\PetrolAppProject\FTPObjects.cpp(101): error C2084: function 'int Indy::Sockets::TIdNetStream::Read(double __gc *,int)' already has a body
c:\PetrolAppProject\FTPObjects.cpp(101): error C2084: function 'int Indy::Sockets::TIdNetStream::Write(double)' already has a body
c:\PetrolAppProject\FTPObjects.cpp(101): error C2084: function 'int Indy::Sockets::TIdNetStream::Write(double,int)' already has a body
c:\PetrolAppProject\FTPObjects.cpp(101): error C2084: function 'void Indy::Sockets::TIdNetStream::ReadBuffer(double __gc *)' already has a body
c:\PetrolAppProject\FTPObjects.cpp(101): error C2084: function 'void Indy::Sockets::TIdNetStream::ReadBuffer(double __gc *,int)' already has a body
c:\PetrolAppProject\FTPObjects.cpp(101): error C2084: function 'void Indy::Sockets::TIdNetStream::WriteBuffer(double)' already has a body
c:\PetrolAppProject\FTPObjects.cpp(101): error C2084: function 'void Indy::Sockets::TIdNetStream::WriteBuffer(double,int)' already has a body
c:\PetrolAppProject\FTPObjects.cpp(101): error C2535: 'int Indy::Sockets::TIdNetStream::Read(double __gc *)' : member function already defined or declared
c:\PetrolAppProject\FTPObjects.cpp(101): error C2535: 'int Indy::Sockets::TIdNetStream::Read(double __gc *,int)' : member function already defined or declared
c:\PetrolAppProject\FTPObjects.cpp(101): error C2535: 'int Indy::Sockets::TIdNetStream::Write(double)' : member function already defined or declared
c:\PetrolAppProject\FTPObjects.cpp(101): error C2535: 'int Indy::Sockets::TIdNetStream::Write(double,int)' : member function already defined or declared
c:\PetrolAppProject\FTPObjects.cpp(101): error C2535: 'void Indy::Sockets::TIdNetStream::ReadBuffer(double __gc *)' : member function already defined or declared
c:\PetrolAppProject\FTPObjects.cpp(101): error C2535: 'void Indy::Sockets::TIdNetStream::ReadBuffer(double __gc *,int)' : member function already defined or declared
c:\PetrolAppProject\FTPObjects.cpp(101): error C2535: 'void Indy::Sockets::TIdNetStream::WriteBuffer(double)' : member function already defined or declared

The exact line of code is:

ftpObj->Put(localFile, remoteFile, false);

However, compilation is successful if I use constant strings instead of references, e.g.:

ftpObj->Put("abc.txt", "abc.txt", false);

The problem seems to be related to managed strings, as the following code will throw the errors:

ftpObj->Put(S"abc.txt", S"abc.txt", false);

Any bright ideas would be helpful!

Thanks

Replies