The combine function been bug since yesterday.

Been trying everything back then, define in the source file, remove some code to prevent overlapping definition, etc...
I don't know what I should do, can anyone help on this?

#ifndef SALES_DATA
#define SALES_DATA

#include <iostream>

struct Sales_data {
    // new members: operations on Sales_data objects
    std::string isbn() const { return bookNo; }
    double avg_price() const;
    Sales_data& combine(const Sales_data&);

    // data members are unchanged from
    std::string bookNo;
    unsigned units_sold;
    double revenue;
};

Sales_data& Sales_data::combine(const Sales_data &rhs)
{
    units_sold += rhs.units_sold;
    revenue += rhs.revenue;
    return *this;
}

std::istream &read(std::istream & is, Sales_data &item);
std::ostream &print(std::ostream &os, const Sales_data & item);
Sales_data add(const Sales_data &lhs, const Sales_data &rhs);

#endif

what compiler and operating systems are you using? And post a few of the errors.

Why don't you just call it a class instead of struct because that's what it is. structs are carry-over from C language and normally do not contain methods. Although both structs and classes are nearly the same in C++ it is more conventional to call it a class when it contains methods.

mingW and windows 7 ultimate 64bit

this is the error:
Click Here

This is the exercise coming from C++ primer 5th edi.
not learned about class yet.

You can't put functions in header files -- move lines 18-21 into main.cpp or some other *.cpp file.

This posting may help explain why it is (generally speaking) a mistake to include functions in a header, and what headers are mainly used for in the first place.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.