Archived

This forum has been archived. Please start a new discussion on GitHub.

cannot allocate an object

I get the following error messages:
streamServer.cpp: In member function ‘virtual int dataStreamServer::run(int, char**)’:
streamServer.cpp:23: error: cannot allocate an object of abstract type ‘FileStoreI’
./dataStreamTransferIS.h:8: note: because the following virtual functions are pure within ‘FileStoreI’:
./dataStreamTransfer.h:510: note: virtual void dataStreamTransfer::FileStore::getDataString(const std::string&, std::string&, const Ice::Current&)
dataStreamTransferIS.cpp: In member function ‘virtual void FileStoreI::getDataString(const std::string&, const std::string&, const Ice::Current&)’:
dataStreamTransferIS.cpp:108: error: passing ‘const std::string’ as ‘this’ argument of ‘std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’ discards qualifiers
dataStreamTransferIS.cpp:119: error: passing ‘const std::string’ as ‘this’ argument of ‘std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’ discards qualifiers
dataStreamTransferIS.cpp:130: error: passing ‘const std::string’ as ‘this’ argument of ‘std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’ discards qualifiers
dataStreamTransferIS.cpp:141: error: passing ‘const std::string’ as ‘this’ argument of ‘std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’ discards qualifiers

I only changed, that my "getDataString" - method has an out Parameter in the interface Definition.
Why???

Comments

  • dwayne
    dwayne St. John's, Newfoundland
    Your implementation of getDataString() is using "const" with the second parameter. This does not match the generated definition, which does not have a const second parameter since it is an out parameter and needs to be modified by the getDataString() implementation.