"Declaration of xxx outside of class is not definition" error
<p>This is the error:  </p>

<pre><code>error: declaration of 'DataStream::DataStream()' outside of class is not definition [ fpermissive]|
||=== Build finished: 1 errors, 0 warnings (0 minutes, 0 seconds) ===|
</code></pre>

<p>This is the main.cpp file:</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;iomanip&gt;
#include "DataStream.h"
#include "MsgPacket.h"


using namespace std;

DataStream * Packet = new DataStream();
DataStream::DataStream();



int main() {

int source;
int destination;
int type;
int port;
int input;
std::string data;

cout &lt;&lt; "My Assignment" &lt;&lt; endl;;


MsgPacket * Packet = new MsgPacket(source,destination,type,port,data);
</code></pre>

<p>}</p>

<p>This is the MsgPacket.h</p>

<pre><code>#ifndef MSGPACKET_H
#define MSGPACKET_H

#include &lt;string&gt;
#include "PacketAddress.h"

using namespace std;

class MsgPacket : public PacketAddress {
public:
    MsgPacket();
    MsgPacket (const MsgPacket &amp; rhs);
    MsgPacket(string dataIn);
    MsgPacket(int source, int destination, int port, int type, std::string data);
    MsgPacket(int ,char data);
    string toString();
    string getData() const {return _data;};
    void setData(string inData) {_data = inData;};
    string dataOutput();
    virtual ~MsgPacket();
    virtual MsgPacket * Clone() { return new MsgPacket(*this); }
protected:
    string _data;
};

#endif // MSGPACKET_H
</code></pre>

<p>And finally this is the MsgPacket.cpp</p>

<pre><code>#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;iostream&gt;
#include &lt;sstream&gt;
#include &lt;string&gt;
#include &lt;iomanip&gt;
#include "msgpacket.h"


using namespace std;

MsgPacket::MsgPacket():
PacketAddress(0,0)
{

}

MsgPacket::MsgPacket (const MsgPacket &amp; rhs):
PacketAddress(rhs),
_data(rhs.getData())
{

}

MsgPacket::MsgPacket(string dataIn):
PacketAddress(0,0){
string temp;
temp = dataIn.substr (0,4);
_source = atoi(temp.c_str());
temp = dataIn.substr (5,4);
_dest = atoi(temp.c_str());
temp = dataIn.substr (10,4);
_type = atoi(temp.c_str());
temp = dataIn.substr (15,4);
_port = atoi(temp.c_str());
_data = dataIn.substr (20,dataIn.length());
#ifdef DEBUG
cout &lt;&lt; "CREATE PACKET: " &lt;&lt; this-&gt;toString() &lt;&lt; endl;
#endif
}

MsgPacket::MsgPacket(int source, int destination):
PacketAddress(source,destination)
{

 }

 MsgPacket::MsgPacket(int source, int destination, int port):
PacketAddress(source,destination)
{
 _port = port;
}

 MsgPacket::MsgPacket(int source, int destination, int type, int port, std::string       data):
 PacketAddress(source, destination)
{
_source = source;
_dest = destination;
_type = type;
_data = data;
_port = port;
}

string MsgPacket::dataOutput()
{
stringstream output;//create a stringstream
output &lt;&lt; setw(4) &lt;&lt; setfill('0') &lt;&lt; _source &lt;&lt; ":" &lt;&lt;  setw(4) &lt;&lt; setfill('0') &lt;&lt;  _dest &lt;&lt; ":" &lt;&lt; setw(4) &lt;&lt; setfill('0') &lt;&lt; _type &lt;&lt; ":" &lt;&lt; setw(4) &lt;&lt; setfill('0') &lt;&lt; _port     &lt;&lt; ":" &lt;&lt; _data;
 return output.str();
}

 string MsgPacket::toString()
{
stringstream output;//create a stringstream
output &lt;&lt; "[" &lt;&lt; showbase &lt;&lt; hex &lt;&lt; this  &lt;&lt; "] S:[" &lt;&lt; _source &lt;&lt; "] D:[" &lt;&lt; _dest &lt;&lt; "] P:[" &lt;&lt; _type &lt;&lt; "] T:[" &lt;&lt; _port &lt;&lt; "]" &lt;&lt; " DATA[" &lt;&lt; _data &lt;&lt; "]";
return output.str();
}
</code></pre>
