error LNK2019: unresolved external symbol "void

Hello All,

I am getting two compile errors and needing help. Please see the description of the program below. And below that is the code for the said program.

Thanks,

Task is to create a pram that manages a simple inventory for a retail store.

Program Input
The input to the program will be the product id number (a 5-digit id number), the manufacturer’s id number (a 4 digit id number), the wholesale price of the product, the mark-up percentage for the product, the description of the product , and the quantity of product in stock.

Output
Prepare a listing of the inventory for the store with appropriate column headings. This listing should include the following:
the product id number;
the product description;
the manufacturer’s id number;
the wholesale price of the product;
the mark-up percentage for the product;
the quantity of product in inventory;
The retail price for the product (the wholesale price increased by the mark-up percentage) should be printed as a separate item from the above listing.

Processing
1). The class variables, which represent a single product sold by the store, should include the following data members:
the product id number integer;
the product description character array;
the manufacturer’s id number integer;
the wholesale price of the product double;
the mark-up percentage for the product double;
the quantity of product in inventory integer;

2). The class should have the following member functions:
a). Two constructors.
The first is the default, which sets all the members of the class to zero.
The second constructor should enable the user to specify all of the initial attributes of the members of the class.
b). Separate functions which return the values of the members of the class.
c). A function that displays the values of the members of the class to the monitor (as described in the “output” section).
d). A function that returns the class object’s retail price (the wholesale price increased by the mark-up percentage).


#include <iostream>
#include <iomanip>

#include "InventoryItem.h"

using namespace std;

const int MAX_INVENTORY = 255;

void DisplayInventory (InventoryItem inv[], int total);

void DisplayInventoryItem (InventoryItem item);

int main ( )
{//begin int main brackets
InventoryItem Inventory [MAX_INVENTORY];

cout << "How many items would you like to enter? ";
int x = 0;
cin >> x;

for (int i=0; i<x; i++)
{//begin for loop bracket
int ProductIdNumber = 0;
int ManufacIdNumber = 0;
int Quantity = 0;
double WholesalePrice = 0;
double MarkUpPercentage = 0;
char ProductDescription [255];

cout << "Please enter data for item " << (i+1) << " " << endl;
cout << "Product Id: " ;
cin >> ProductIdNumber;

cout << "Manufacturer's Id: " ;
cin >> ManufacIdNumber;

cout << "Quantity: " ;
cin >> Quantity;

cout << "Wholesale price: " ;
cin >> WholesalePrice;

cout << "Mark up percentage: " ;
cin >> MarkUpPercentage;

cout << "Description of product: " ;
cin.ignore (256, '\n');
cin.getline(ProductDescription, 254), '\n' ;

Inventory [i] = InventoryItem (ProductIdNumber, ManufacIdNumber, Quantity, WholesalePrice, MarkUpPercentage, ProductDescription);
}//end for loop bracket

DisplayInventory(Inventory, x);
return 0;
}//end int main brackets

void DisplayInventoryItem (InventoryItem inv[], int total)
{//begin display brackets
//cout << setfill ('-') << setw(80) << "-" << endl;
cout << setfill (' ') << setw(6) << "Product Id "
<< setw(30) << "Description"
<< setw(8) << "Manufacturer's Id"
<< setw(9) << "Wholesale"
<< setw(9) << "Markup"
<< setw(9) << "Retail"
<< setw(8) << "Quantity"
<< endl;
//cout << setfill ('-') << setw(80) << "-" << endl << setfill ('');

for (int x=0; x<total; x++)
inv[x].DisplayInventoryItem ();

}//end dispay brackets

#include <iostream>
#include <iomanip>

#include "InventoryItem.h"
#include <string.h>

using namespace std;

InventoryItem::InventoryItem ( )
{
ProductIdNumber = 0;
ManufacIdNumber = 0;
Quantity = 0;
WholesalePrice = 0;
MarkUpPercentage = 0;
ProductDescription [0] = '\0';
}


double InventoryItem::getRetailValue() const
{
return WholesalePrice * (1 + getMarkUpPercentage ());
}


void InventoryItem::DisplayInventoryItem() const
{
cout << setw(6) << getProductIdNumber ( )
<< setw(30) << getProductDescription ( )
<< fixed << setprecision (0) << setw(8) << getManuFacIdNumber ( )
<< fixed << setprecision (2) << setw(9) << getWholesalePrice ( )
<< fixed << setprecision (2) << setw(9) << getMarkUpPercentage ( )
<< fixed << setprecision (2) << setw(9) << getRetailValue ( )
<< fixed << setprecision (0) << setw(8) << getQuantity ( )
<< endl;
}


InventoryItem::InventoryItem (int InIdNumber, int InManufacIdNumber, int InQuantity, double InWholesale, double InMarkup, const char* InDescription)
{
setDataInventory (InIdNumber, InManufacIdNumber, InQuantity, InWholesale, InMarkup, InDescription);
}


void InventoryItem::setDataInventory (int InIdNumber, int InManufacIdNumber, int InQuantity, double InWholesale, double InMarkup, const char* InDescription)
{
ProductIdNumber = InIdNumber;
ManufacIdNumber = InManufacIdNumber;
Quantity = InQuantity;
WholesalePrice = InWholesale;
MarkUpPercentage = InMarkup;
strcpy_s (ProductDescription, InDescription);
}


int InventoryItem::getManuFacIdNumber () const
{
return ManufacIdNumber;
}


int InventoryItem::getProductIdNumber() const
{
return ProductIdNumber;
}


const char* InventoryItem::getProductDescription() const
{
return ProductDescription;
}


double InventoryItem::getWholesalePrice() const
{
return WholesalePrice;
}


double InventoryItem::getMarkUpPercentage() const
{
return MarkUpPercentage;
}


int InventoryItem::getQuantity() const
{
return Quantity;
}

#ifndef INVENTORYITEM_H
#define INVENTORYITEM_H

class InventoryItem //declares class StoreInventory
{ //begins class brackets
public: //declaring public member functions

//constructors declared
InventoryItem ( ); //Default constructor setting members of the class to zero
InventoryItem (int ProductIdNumber, int ManufacIdNumber, int Quantity, double WholesalePrice, double MarkUpPercentage, const char* ProductDescription); //Constructor that enables the user to specify all of the initial attributes of the members of the class

//returning values of private datamembers
int getProductIdNumber ( ) const; //returning an int which is the product id
int getManuFacIdNumber ( )const; //returning an int which is the manufacturer's id number
int getQuantity ( )const; //returning an int which is the quantity of the product

double getWholesalePrice ( )const; //returning a double which is the wholesale of the product
double getMarkUpPercentage ( )const; //returning a double which is the mark up percentage
double getRetailValue ( ) const; //returning a double that is the mark up price

const char* getProductDescription ( )const; //returning a string which is the product's description

//displays the values of the members of the class to the monitor
void DisplayInventoryItem ( ) const; //function that displays the store inventory

void setDataInventory (int InIdNumber, int InManufacIdNumber, int InQuantity, double InWholesale, double InMarkup, const char* InDescription); //function that sets the data

private: //declaring private data members

// Data members declared
int ProductIdNumber; //An array of integers for storing the product id number
int ManufacIdNumber; //An array of integers for storing the manufacturer's id number of a product
int Quantity; //An array of integers for storing the quantity of a product

double WholesalePrice; //An array of doubles for storing the wholesale price of a product
double MarkUpPercentage; //An array of doubles for storing the mark up percentage

mutable char ProductDescription [255]; //An array of strings for storing the product's description with a max inventory size and max string size


}; //end class brackets

#endif


Wow, wall of text!
Use code braces around code (the <> symbol in the format section, or type code and /code with square braces around it) to make code more readable for the rest of us.

As it is, I took the effort to read through all this, and found one mistake.
You declared DisplayInventory at the top of your main.cpp file, but forgotten to define it, so when it's called at the end of int main(), the compiler doesn't know what to do.

If you want help beyond that, it would be better to use code tags so we can read your code better.
Topic archived. No new replies allowed.