Error -"should have been declared inside 'Base'"

Hi
I’m getting the following error and wonder if anyone can offer a fix?


Stream.cpp:92:49: error: 'Base::DataStream& Base::readSwapOrder(Base::DataStream&)' should have been declared inside 'Base'
Stream.cpp:101:50: error: 'Base::DataStream& Base::writeSwapOrder(Base::DataStream&)' should have been declared inside 'Base'

In Stream.h under I see;


class BaseExport DataStream
{
public:
...
...
...
friend DataStream& readSwapOrder (DataStream& rcs);
friend DataStream& writeSwapOrder (DataStream& rcs);

Here are the two files;
Stream.h http://pastebin.com/CrM49uGD
Stream.cpp - http://pastebin.com/n0a0g6wG

Compiling with “-ffriend-injection” should remove the error message. Otherwise just do as asked, declare the functions inside the Base namespace.

So, in Stream.h:
namespace Base {

class DataStream;
typedef DataStream *PDataStream;
typedef DataStream &RDataStream;

DataStream& readSwapOrder (DataStream& rcs);
DataStream& writeSwapOrder (DataStream& rcs);

class BaseExport DataStream
{

Hi
Awesome, many thanks!! Now have moved onto the next error… :slight_smile:


Cheers Malcolm °¿° (Linux Counter #276890)
SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.32.23-0.3-default
up 4 days 20:05, 5 users, load average: 0.04, 0.06, 0.09
GPU GeForce 8600 GTS Silent - Driver Version: 260.19.12