P
Piotr Sawuk
I'm a newbie in the world of c++, and I am used to learn a programming
language simply by programming. Unfortunately I where unable to find
any useful helpfile for this language, in which such basic things as
"class", "operator ::", or even my compiler's error-messages would
get explained in a quick-reference kind of way (as turbo pascal did
with the pascal-language). Therefore I was forced to read some books
and tutorials. However, I'm too lazy to do any exercises, and therefore
I'm stuck in the error-message jungle without a clue of what the compiler
does expect from me.
Does anyone know of some good manual on gcc's error-messages?
Try to compile with some recent gnu c++ compiler:
#include <string>
#include <list>
#include <ext/hash_map>
using namespace std;
using namespace __gnu_cxx;
class Song;
class Song::File;
//error: no type named "File" in "struct Song"
//error: forward declaration of "struct File"
class PlayListublic list<class Song> {
friend class Song;
protected:
typedef hash_map<string, class Song::File> Hmap;
//error: no type named "File" in struct "Song"
static Hmap fileset;
} /*playlist*/;
class Song {
friend class PlayList;
protected:
class File {
int size;
const std::string songName;
File(std::string s):songName(s){}
};
class PlayList::iterator next;
PlayList::Hmap::iterator fil;
//...instantiated from here:
//error: "std:air<_T1,_T2>::second" has incomplete type
PlayList* parent;
};
int main (void){
//tests://TODO:add some tests for memory-leakage!
//1) con- and de-structor at stack
{
PlayList p1();
// std::cout<<p1<<std::endl;
}
//1) con- and de-structor in heap
PlayList* p2=new PlayList();
// std::cout<<*p2<<std::endl;
delete p2;
}
language simply by programming. Unfortunately I where unable to find
any useful helpfile for this language, in which such basic things as
"class", "operator ::", or even my compiler's error-messages would
get explained in a quick-reference kind of way (as turbo pascal did
with the pascal-language). Therefore I was forced to read some books
and tutorials. However, I'm too lazy to do any exercises, and therefore
I'm stuck in the error-message jungle without a clue of what the compiler
does expect from me.
Does anyone know of some good manual on gcc's error-messages?
Try to compile with some recent gnu c++ compiler:
#include <string>
#include <list>
#include <ext/hash_map>
using namespace std;
using namespace __gnu_cxx;
class Song;
class Song::File;
//error: no type named "File" in "struct Song"
//error: forward declaration of "struct File"
class PlayListublic list<class Song> {
friend class Song;
protected:
typedef hash_map<string, class Song::File> Hmap;
//error: no type named "File" in struct "Song"
static Hmap fileset;
} /*playlist*/;
class Song {
friend class PlayList;
protected:
class File {
int size;
const std::string songName;
File(std::string s):songName(s){}
};
class PlayList::iterator next;
PlayList::Hmap::iterator fil;
//...instantiated from here:
//error: "std:air<_T1,_T2>::second" has incomplete type
PlayList* parent;
};
int main (void){
//tests://TODO:add some tests for memory-leakage!
//1) con- and de-structor at stack
{
PlayList p1();
// std::cout<<p1<<std::endl;
}
//1) con- and de-structor in heap
PlayList* p2=new PlayList();
// std::cout<<*p2<<std::endl;
delete p2;
}