I got this error and I can not solve it myself
source.cpp:85:8: error: request for member 'put_tag' in 'aux', which is of non-class type 'Keyword()' source.cpp:86:8: error: request for member 'put_site' in 'aux', which is of non-class type 'Keyword()' make: *** [source.o] Error 1
the code that gives me this error,
Keyword aux(); aux.put_tag(word); aux.put_site(site);
I should mention that the word and site are char * type
Now my keyword class definition is as follows:
class Keyword{ private: std::string tag; Stack<std::string> weblist; public: Keyword(); ~Keyword(); void put_tag(std::string word) { tag = word; } void put_site(std::string site) { weblist.push(site); } };
Thank you very much!
Update
Changing
Keyword aux(); aux.put_tag(word); aux.put_site(site);
in
Keyword aux; aux.put_tag(word); aux.put_site(site);
I got this error:
source.o: In function `Algorithm::indexSite(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': source.cpp:(.text+0x2c6): undefined reference to `Keyword::Keyword()' source.cpp:(.text+0x369): undefined reference to `Keyword::~Keyword()' source.cpp:(.text+0x4a8): undefined reference to `Keyword::~Keyword()' source.o: In function `Keyword::put_site(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)': source.cpp:(.text._ZN7Keyword8put_siteESs[Keyword::put_site(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)]+0x2a): undefined reference to `Stack<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >::push(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)' collect2: ld returned 1 exit status make: *** [tema3] Error 1
source share