Need help Building and running this

Hi!

The first time I'm using a non standard/non me created library so I'm having trouble building it.


I'm using the boost library.
I've created a project in Code::Blocks.
And I've changed the search directories to include the folder where the library is.

But when I try to build and run these two files It doesn't like me at all and gives me 3 warnings:
1
2
3
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\stl_tree.h|1285|required from 'std::pair<std::_Rb_tree_iterator<_Val>, bool> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_unique(const _Val&) [with _Key = Order; _Val = Order; _KeyOfValue = std::_Identity<Order>; _Compare = std::less<Order>; _Alloc = std::allocator<Order>]'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\stl_set.h|415|required from 'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Key>, _Compare, typename _Alloc::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = Order; _Compare = std::less<Order>; _Alloc = std::allocator<Order>; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Key>, _Compare, typename _Alloc::rebind<_Key>::other>::const_iterator = std::_Rb_tree_const_iterator<Order>; std::set<_Key, _Compare, _Alloc>::value_type = Order]'|
C:\Users\Zonaz\Documents\Programmering\C++\EvEChecker.cpp|82|required from here|


And an error:
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\stl_function.h|237|error: no match for 'operator<' in '__x < __y'|

And a lot of notes but I guess I can ignore them.

Current Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//EvEChecker.hpp
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp>
#include <boost/foreach.hpp>
#include <string>
#include <set>
#include <exception>
#include <iostream>

using namespace std;

class Order{
    protected:
        string m_StationName,m_Expires, m_ReportedTime, m_OrderID;
        int m_Region, m_Station, m_Security, m_Range, m_Price, m_VolRemain, m_MinVolume;

    public:
        //constructor
        Order(string orderID, string stationName, string expires,string reported, int region, int station,int security, int range, int price, int volremain, int minvolume){
            m_OrderID = orderID;
            m_StationName = stationName;
            m_Expires = expires;
            m_ReportedTime = reported;
            m_Region = region;
            m_Station = station;
            m_Security = security;
            m_Range = range;
            m_Price = price;
            m_VolRemain = volremain;
            m_MinVolume = minvolume;
        }

        bool operator< ( const Order& that ) const { return m_OrderID < that.m_OrderID ; }

        string getStationName(){return m_StationName;};
        string getExpires(){return m_Expires;};
        string getReportedTime(){return m_ReportedTime;};
        int getRegion(){return m_Region;};
        int getStation(){return m_Station;};
        int getSecurity(){return m_Security;};
        int getRange(){return m_Range;};
        int getPrice(){return m_Price;};
        int getVolRemain(){return m_VolRemain;};
        int getMinVolume(){return m_MinVolume;};

};

class MarketItem{
    protected:
        int m_ItemID, m_Hours, m_Minqty;
        string m_ItemName;
        //unigue Order IDs
        std::set<Order> m_SellOrders, m_BuyOrders;
    public:
        //get the data from the XML parser and extract the data
        void load(int, string);

        int getItemID(){return m_ItemID;};
        int getHours(){return m_Hours;};
        int getMinqty(){return m_Minqty;};
        string getItemName(){return m_ItemName;};

        //they don't need to change thereof const &
        const std::set<Order>& getSellOrders(){const std::set<Order>& temp = m_SellOrders; return temp;};
        const std::set<Order>& getBuyOrders(){const std::set<Order>& temp = m_BuyOrders; return temp;};

};

void MarketItem::load(int itemID, string filename){
    using boost::property_tree::ptree;
    ptree pt;

    read_xml(filename , pt);
    //load all the values
    m_ItemID = pt.get<int>("quicklook.item");
    m_ItemName = pt.get<std::string>("quicklook.itemname");
    m_Hours = pt.get<int>("quicklook.hours");
    m_Minqty = pt.get<int>("quicklook.minqty");

    BOOST_FOREACH(ptree::value_type const& v, pt.get_child("quicklook.sell_orders")){
        if(v.first == "order"){
            m_SellOrders.insert(Order(v.second.get<std::string>("<xmlattr.id>"), v.second.get<std::string>("station"), v.second.get<std::string>("expires"), v.second.get<std::string>("reported_time"),
                v.second.get<int>("region"), v.second.get<int>("station"), v.second.get<int>("security"), v.second.get<int>("range"), v.second.get<int>("price"),
                v.second.get<int>("vol_remain"), v.second.get<int>("min_volume")));
        }
    }
}


1
2
3
4
5
6
7
8
9
//Main.cpp
#include <EvEChecker.hpp>

int main(){
    MarketItem mi34;
    mi34.load(34, "quicklook.xml");
    cout << mi34.getSellOrders().size()<< endl;
    return 0;
}


I'm simply trying to test this so I know if i have understood the library correct or not.

Any help?
I'm using code blocks 12.11 and mingw32-gcc-4.7.2.
It compiles just fine
argh argh argh
ok, gonna reinstall everything
Ok restalled it all I believe. Still the same problem.

Can anyone give me a quick run through of the things that might go wrong when doing this?

or even better: solve the problem? :P
How many files named EvEChecker.hpp are there on your machine?



one, and one only.
Last edited on
Changed all the set containers to vector containers, same error...

1
2
3
4
5
6
7
8
9
10
11
//stl_function.h

line 230:
  /// One of the @link comparison_functors comparison functors@endlink.
  template<typename _Tp>
    struct less : public binary_function<_Tp, _Tp, bool>
    {
      bool
      operator()(const _Tp& __x, const _Tp& __y) const
      { return __x < __y; }         //<----- the error points here 
    };
Last edited on
any ideas? i'm clueless. And I really hate being stuck on things that i can't find a fix for in the first 3 days. Google says my overloaded < is the problem... but it doesn't seem to be any wrong with the syntax of the overload...
Last edited on
ok... by recreating the project AND the file the problem is now solved...

This is one weird day...
Topic archived. No new replies allowed.