Hey all!
I am trying to build this code and I am running into a bit of trouble. Visual c++ gives me this error:
>Profile.cpp
1>c:\users\janice\documents\visual studio 2008\projects\assignment6\assignment6\profile.cpp(101) : error C2027: use of undefined type 'Post'
1> c:\users\janice\documents\visual studio 2008\projects\assignment6\assignment6\profile.h(6) : see declaration of 'Post'
1>c:\users\janice\documents\visual studio 2008\projects\assignment6\assignment6\profile.cpp(101) : error C3861: 'setPost': identifier not found
1>c:\users\janice\documents\visual studio 2008\projects\assignment6\assignment6\profile.cpp(102) : error C2027: use of undefined type 'Post'
1> c:\users\janice\documents\visual studio 2008\projects\assignment6\assignment6\profile.h(6) : see declaration of 'Post'
1>c:\users\janice\documents\visual studio 2008\projects\assignment6\assignment6\profile.cpp(102) : error C3861: 'getPost': identifier not found
1>Build log was saved at "file://c:\Users\Janice\Documents\Visual Studio 2008\Projects\Assignment6\Assignment6\Debug\BuildLog.htm"
So, basically, the addToWall function is in the Profile class (not Post class) and is calling a function in the Post class ... and it is returning an error.
Please help! Thank you so much!
//Post Class Definition
//The Post class will serve as a Outbox or a Sent messages array
//That means that each person has their own Outbox
#include <string>
#include <iostream>
using namespace std;
const int maxNumPosts = 500;
class Profile;
class Post {
public:
// Constructor that sets name an city and put this profile in allProfiles
Post(string inputName);
void setPost(Profile* person, char); // Creates the Outbox array
char * getPost(); // Will return a particular post to build someone's wall
private:
void setName(string);
string getName();
string name;
static int numPosts; // Number of posts each person made so far
static char posts[maxNumPosts]; //So each person has an outbox of posts
};
// This is in the Post class
void Profile::addToWall(Profile *person, string inputText) // will take the persons outbox and add link it to a wall
{
cin >> inputText; // input the text
Post::setPost(this, inputText); // send the current object and the text to setPost function
theWall[wallPastes] = Post::getPost(); // now, get the post back and assemble the wall
wallPastes++;
}