| | |
Object not declared in scope (didn't find answer in page)
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2008
Posts: 2
Reputation:
Solved Threads: 0
The section, of my program, that has to do with the error extracts a description from an html file or site. We are to find it based on three criteria. I have two down and this third one is giving me problems. I tried to create a DescripChars object in my ParseDescription method and it comes up with this error. I am manually making a make file as I go, so I will include that too. (Our teacher wanted us to know how it worked before we used automated make files and I have not had time to learn how to use an automated one yet.)
Here is my watered down Parse Description method which is part of the HTMLParser class
[code = c++]
string & HTMLParser:
arseDescription()
{
DescripChars getChars;
return description;
}
[/code]
My watered down HTMLParser.h file follows:
[code = c++]
#ifndef CS240_HTMLPARSER_H
#define CS240_HTMLPARSER_H
#include <string>
#include "BST.h"
#include "WordProcessor.h"
#include "LinkedList.h"
#include "StringUtil.h"
#include "DescripChars.h"
using namespace std;
class HTMLParser
{
private:
string description;
public:
string & ParseDescription();
};
#endif
[/code]
Now I will list my DescripChars.h file
I don't think I need to list the Descrip.cpp file so I won't do that
[code = c++]
#ifdef CS240_DescripChars_H
#define CS240_DescripChars_H
#include <string>
#include <cstring>
using namespace std;
class DescripChars
{
private:
int length;
string description;
public:
DescripChars();
void GetCharacters(string & line);
string & GetString();
};
#endif
[/code]
Here are parts of my make file:
bin/test: obj/test.o obj/PageIndex.o obj/BST.o obj/HTMLParser.o \
obj/LinkedList.o obj/LinkIterator.o obj/WordProcessor.o obj/DescripChars.o \
lib/libutils.a
g++ -g -o bin/test obj/test.o obj/PageIndex.o obj/HTMLParser.o \
obj/BST.o obj/LinkedList.o obj/LinkIterator.o obj/WordProcessor.o \
obj/DescripChars.o lib/libutils.a
chmod a+x bin/test
obj/HTMLParser.o: src/HTMLParser.cpp
g++ -g -o obj/HTMLParser.o -c -I inc -I utils/cs240utils/include \
-lboost_iostreams -lboost_program_options -lboost_filesystem src/HTMLParser.cpp
obj/DescripChars.o: src/DescripChars.cpp
g++ -g -o obj/DescripChars.o -c -I inc src/DescripChars.cpp
my .h files are in the inc folder and I am using another library that is in another folder as indicated in the HTMLParser line my .cpp files are in the src directory
Here is my watered down Parse Description method which is part of the HTMLParser class
[code = c++]
string & HTMLParser:
arseDescription(){
DescripChars getChars;
return description;
}
[/code]
My watered down HTMLParser.h file follows:
[code = c++]
#ifndef CS240_HTMLPARSER_H
#define CS240_HTMLPARSER_H
#include <string>
#include "BST.h"
#include "WordProcessor.h"
#include "LinkedList.h"
#include "StringUtil.h"
#include "DescripChars.h"
using namespace std;
class HTMLParser
{
private:
string description;
public:
string & ParseDescription();
};
#endif
[/code]
Now I will list my DescripChars.h file
I don't think I need to list the Descrip.cpp file so I won't do that
[code = c++]
#ifdef CS240_DescripChars_H
#define CS240_DescripChars_H
#include <string>
#include <cstring>
using namespace std;
class DescripChars
{
private:
int length;
string description;
public:
DescripChars();
void GetCharacters(string & line);
string & GetString();
};
#endif
[/code]
Here are parts of my make file:
bin/test: obj/test.o obj/PageIndex.o obj/BST.o obj/HTMLParser.o \
obj/LinkedList.o obj/LinkIterator.o obj/WordProcessor.o obj/DescripChars.o \
lib/libutils.a
g++ -g -o bin/test obj/test.o obj/PageIndex.o obj/HTMLParser.o \
obj/BST.o obj/LinkedList.o obj/LinkIterator.o obj/WordProcessor.o \
obj/DescripChars.o lib/libutils.a
chmod a+x bin/test
obj/HTMLParser.o: src/HTMLParser.cpp
g++ -g -o obj/HTMLParser.o -c -I inc -I utils/cs240utils/include \
-lboost_iostreams -lboost_program_options -lboost_filesystem src/HTMLParser.cpp
obj/DescripChars.o: src/DescripChars.cpp
g++ -g -o obj/DescripChars.o -c -I inc src/DescripChars.cpp
my .h files are in the inc folder and I am using another library that is in another folder as indicated in the HTMLParser line my .cpp files are in the src directory
![]() |
Other Threads in the C++ Forum
- Previous Thread: First and Last Name in One String?
- Next Thread: Where is the Memory Leak ?
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char char* class classes coding compile compiler console conversion count data database delete deploy desktop developer directshow dll dynamiccharacterarray email encryption error file forms fstream function functions game getline google graph homeworkhelp homeworkhelper iamthwee ifstream input int integer lib linkedlist linux list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct template templates text tree unix url vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets





