Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

C++ error C2228: left of '.pushLink' must have class/struct/u

$
0
0
I'm trying to build Whalebot but am receiving this error that I haven't been able to resolve. Any help would be greatly appreciated!

#ifndef _LINK_EXTRACTOR_H_
#define _LINK_EXTRACTOR_H_

#include <iterator>
#include <iostream>
#include <string>

#include <C:\Users\JJ\Documents\Visual Studio 2010\Projects\Whalebot4\Whalebot4\webspider\include\ParserSax.h>
#include <C:\Users\JJ\Documents\Visual Studio 2010\Projects\Whalebot4\Whalebot4\webspider\include\utils.h>

#include <C:\Users\JJ\Documents\Visual Studio 2010\Projects\Whalebot4\Whalebot4\webspider\include\prefix.h>
#include <C:\Users\JJ\Documents\Visual Studio 2010\Projects\Whalebot4\Whalebot4\webspider\include\link.h>
#include <C:\Users\JJ\Documents\Visual Studio 2010\Projects\Whalebot4\Whalebot4\webspider\include\link_factory.h>

//using namespace std;


template <class T>
class CLinkExtractor : public htmlcxx::HTML::ParserSax {
public:

    CLinkExtractor(T &out)
    :m_out(out) {}

    void extract(std::istream &in) {
        std::string buff("");
        std::istreambuf_iterator<char> walker(in),
                stop;
        while (walker != stop) {
            buff += *walker;
            ++walker;
        }

        parse(buff);
    }

    static bool isParse(const std::string &ext) {
        return ext == "html";
    }
protected:

    void foundTag(htmlcxx::HTML::Node node, bool isEnd) {
        if (node.tagName() == "a") {
            node.parseAttributes();
            std::pair<bool, std::string > res(node.attribute("href"));
            if (res.first) {
                m_out.pushLink((htmlcxx::HTML::decode_entities(res.second)));
            }
        }
    }
private:
    T &m_out;
};

#endif //_LINK_EXTRACTOR_H_



The error...

c:\users\jj\documents\visual studio 2010\projects\whalebot4\whalebot4\webspider\include\link_extractor.h(47): error C2228: left of '.pushLink' must have class/struct/union
type is 'int'

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>