I've been trying to fix these errors for a while now and I'm having difficulty. Can anyone help? I've attached my header file, .cpp file and main.

The C2533 and C2511 are both in my .cpp file.

c:\documents and settings\tina\my documents\visual studio 2008\projects\csci112lab4\csci112lab4\invoice.cpp(15) : error C2533: 'Invoice::{ctor}' : constructors not allowed a return type
c:\documents and settings\tina\my documents\visual studio 2008\projects\csci112lab4\csci112lab4\invoice.cpp(113) : error C2511: 'void Invoice::print(Invoice)' : overloaded member function not found in 'Invoice'
        c:\documents and settings\tina\my documents\visual studio 2008\projects\csci112lab4\csci112lab4\invoice.h(11) : see declaration of 'Invoice'

The C 2144 error is in my main.

c:\documents and settings\tina\my documents\visual studio 2008\projects\csci112lab4\csci112lab4\main.cpp(15) : error C2144: syntax error : 'int' should be preceded by ';'

Edited 3 Years Ago by Nick Evan: Fixed formatting

Attachments
//***********************************************************
//Invoice .cpp file
//Author: Amanda Persons		CSCI 112-001
//Date written: 04 Dec 08
//Class Invoice definition
//requires Invoice.h header file
//************************************************************
#include <iostream>
#include <string>
using namespace std;
#include "Invoice.h"

											//default Invoice constructor
Invoice::Invoice(int invoiceNumValue, int quantityShipValue, int partNumValue, string partDescValue, float salesTaxRateValue, float unitPriceValue, float shipCostValue)
{
	setInvoiceNum(invoiceNumValue);
	setQuantityShip(quantityShipValue);
	setPartNum(partNumValue);
	setPartDesc(partDescValue);
	setSalesTaxRate(salesTaxRateValue);
	setUnitPrice(unitPriceValue);
	setShipCost(shipCostValue);
}											//end Invoice constructor

void Invoice::initialize()
{											//initialzes all values to zero or empty
	Invoice::setInvoiceNum(0);
	Invoice::setQuantityShip(0);
	Invoice::setPartNum(0);
	Invoice::setPartDesc("");
	Invoice::setUnitPrice(0.0);
}
float Invoice::calcTotCost()
{											//finds total cost
	return ((QuantityShip*UnitPrice)+Invoice::calcSalesTaxAm()+ShipCost);
}

float Invoice::calcSalesTaxAm()
{											//finds the amount of sales tax
	return (QuantityShip * UnitPrice * SalesTaxRate);
}

int Invoice::getInvoiceNum()
{
	return InvoiceNum;
}											//end function getInvoiceNum
											//set invoice number
void Invoice::setInvoiceNum(int invoiceNumValue)
{
	InvoiceNum = invoiceNumValue;
}											//end fuction setInvoiceNum

int Invoice::getQuantityShip()
{
	return QuantityShip;
}											//end function getQuantityShip
											//set quantity of item in shipment
void Invoice::setQuantityShip(int quantityShipValue)
{
	QuantityShip = quantityShipValue;
}											//end fuction setQuantityShip

int Invoice::getPartNum()
{
	return PartNum;
}											//end function getPartNum
											//set part number
void Invoice::setPartNum(int partNumValue)
{
	PartNum = partNumValue;
}											//end fuction setPartNum

string Invoice::getPartDesc()
{
	return PartDesc;
}											//end function PartDesc
											//set part description
void Invoice::setPartDesc(string partDescValue)
{
	PartDesc = partDescValue;
}											//end fuction setPartDesc

float Invoice::getSalesTaxRate()
{
	return SalesTaxRate;
}											//end function SalesTaxRate
											//set sales tax rate
void Invoice::setSalesTaxRate(float salesTaxRateValue)
{
	SalesTaxRate = salesTaxRateValue;
}											//end fuction setSalesTaxRate

float Invoice::getUnitPrice()
{
	return UnitPrice;
}											//end function getUnitPrice
											//set unit price
void Invoice::setUnitPrice(float unitPriceValue)
{
	UnitPrice = unitPriceValue;
}											//end fuction setUnitPrice

float Invoice::getShipCost()
{
	return 5.00;
}											//end function ShipCost
											//set shipping cost
void Invoice::setShipCost(float shipCostValue)
{
	ShipCost = shipCostValue;
}											//end fuction setShipCost
void Invoice::print(Invoice bill)
{											//print values in current bill
	cout<<"Invoice Number: "<<bill.getInvoiceNum<<endl<<endl;
	cout<<"Part Number: "<<bill.getPartNum<<endl;
	cout<<"Part Description: "<<bill.getPartDesc<<endl;
	cout<<"Quantity Shipped: "<bill.getQuantityShip<<endl;
	cout<<"Unit Price ($/item): "<<bill.getUnitPrice<<endl;
	cout<<"Sales Tax Rate: "<<bill.getSalesTaxRate<<endl;
	cout<<"Sales Tax Amount: "<<bill.calcSalesTaxAm<<endl;
	cout<<"Shipping Cost: "<<bill.getShippingCost<<endl;
	cout<<"Total Cost: "<<bill.calcTotCost<<endl;
}
//***********************************************************
//Invoice header file
//Author: Amanda Persons		CSCI 112-001
//Date written: 04 Dec 08
//Class Invoice definition
//************************************************************
#include <string>
using namespace std;

class Invoice
{
public:
											//default Invoice constructor
	Invoice(int=0, int=0, int=0, string="", float=0.05, float=0.0, float=5.00);
	void initialize();
	float calcTotCost();
	float calcSalesTaxAm();
											//accessor functions for InvoiceNum
	void setInvoiceNum(int);
	int getInvoiceNum();
											//accessor functions for QuantityShip
	void setQuantityShip(int);
	int getQuantityShip();
											//accessor functions for PartNum
	void setPartNum(int);
	int getPartNum();
											//accessor functions for PartDesc
	void setPartDesc(string);
	string getPartDesc();
											//accessor functions for SalesTaxAm
	void setSalesTaxRate(float);
	float getSalesTaxRate();
											//accessor functions for UnitPrice
	void setUnitPrice(float);
	float getUnitPrice();
											//accessor functions for ShipCost
	void setShipCost(float);
	float getShipCost();

	void print(Invoice) const;
private:
	int InvoiceNum;
	int QuantityShip;
	int PartNum;
	string PartDesc;
	float UnitPrice;
	float SalesTaxRate;
	float ShipCost;
}
//***********************************************************
//Invoice Allocation Lab
//Author: Amanda Persons		CSCI 112-001
//Date written: 04 Dec 08
//Allows user to create 10,000 invoices and then edit them
//requires Invoice.h and Invoice.cpp files
//************************************************************

#include <iostream>
#include <string>
using namespace std;
#include "Invoice.h"


int main()
{
	cout<<"This program allows storing and manipulation of invoices."<<endl;
	Invoice *bill = new Invoice[10000];		//dynamically allocates memory for array
	int num = 0;							//holds position in array
	int invnum = 0;							//holds invoice number
	int inum = 0;							//holds integer value
	string str;								//holds string value
	float fnum = 0.0;						//holds float value
	do
	{
		cout<<"Enter invoice number (if you wish to stop, enter 0): ";
		cin>>invnum;						//holds user choice or invoice number
		cout<<endl;
		bill[num].setInvoiceNum(invnum);
		if (invnum > 0)
		{									//begin setting values for current invoice
			cout<<"Enter quantity shipped: ";
			cin>>inum;
			bill[num].setQuantityShip(inum);//sets quantity shipped
			cout<<endl;
			cout<<"Enter part number: ";
			cin>>inum;
			bill[num].setPartNum(inum);		//sets part number
			cout<<endl;
			cout<<"Enter short part description: ";
			cin>>str;
			bill[num].setPartDesc(str);		//sets part description
			cout<<endl;
			cout<<"Enter unit price: ";
			cin>>fnum;
			bill[num].setUnitPrice(fnum);	//sets unit price
			cout<<endl;
		}
		num++;
	}while (inum != 0);						//end do-while loop when user choses
	cout<<"Entering edit mode."<<endl;
	do
	{										//beginning of edit mode
		cout<<"Enter invoice number: ";
		cin>>invnum;						//stores desired invoice number
		int place = 0;						//holds position in array
		bool located = false;				//determines if invoice is found
		if (invnum != 0)
		{									//begin search for invoice
			while((place != (num+1)) && (located != true))
			{
				if (bill[place].getInvoiceNum() == inum)
					located = true;			//found desired invoice
				else
					place++;				//increment position holder
			}
			if (located == true)			//begin editing of current invoice
			{
				int choice = 0;
				cout<<"What would you like to change?"<<endl;
				cout<<"1 - Quantity shipped."<<endl;
				cout<<"2 - Part number."<<endl;
				cout<<"3 - Part description."<<endl;
				cout<<"4 - Unit price."<<endl;
				cout<<"Change number: ";
				cin>>choice;				//hold user choice
				cout<<endl<<"New Value: ";
				switch (choice)				//switch for ediing select portion of invoice
				{
				case 1:						//user choses Quantity shipped
					cin>>inum;
					bill[place].setQuantityShip(inum);
					cout<<endl;
					break;
				case 2:						//user choses Part Number
					cin>>inum;
					bill[place].setPartNum(inum);
					cout<<endl;
					break;
				case 3:						//user choses Part Description
					cin>>str;
					bill[place].setPartDesc(str);
					cout<<endl;
					break;
				case 4:						//user choses Unit Price
					cin>>fnum;
					bill[place].setUnitPrice(fnum);
					break;
				default:					//catch all other inputs
					cout<<"Incorrect choice entered"<<endl;
					break;
				}							//end of switch
			}								//end of
		}									//end of
	} while (invnum != 0);					//end of do-while when user choses
	delete [] bill;
	char exit_char;	                        //Temporary for input           
	cout << "\nPress any key and <enter> to exit \n";
	cin >> exit_char;                       //Wait for key response before exiting.
	return 0;
}											//end main

Thanks so much!

That solves two errors, but the C2511 is still there.

The error is as follows:

c:\documents and settings\tina\my documents\visual studio 2008\projects\csci112lab4\csci112lab4\invoice.cpp(113) : error C2511: 'void Invoice::print(Invoice)' : overloaded member function not found in 'Invoice'
c:\documents and settings\tina\my documents\visual studio 2008\projects\csci112lab4\csci112lab4\invoice.h(11) : see declaration of 'Invoice'

My program code is attached. Please help. This assignment is due at midnight and I can't get the bloody thing to even compile so that I can start debugging.

It involves this line:

void Invoice::print(Invoice *bill)
{			//print values in current bill

Which comes from:

class Invoice
{	
...

void print(Invoice *) const;

Thanks!

Attachments
//***********************************************************
//Invoice .cpp file
//Author: Amanda Persons		CSCI 112-001
//Date written: 04 Dec 08
//Class Invoice definition
//requires Invoice.h header file
//************************************************************
#include <iostream>
#include <string>
using namespace std;
#include "Invoice.h"

											//default Invoice constructor
Invoice::Invoice(int invoiceNumValue, int quantityShipValue, int partNumValue, string partDescValue, float salesTaxRateValue, float unitPriceValue, float shipCostValue)
{
	setInvoiceNum(invoiceNumValue);
	setQuantityShip(quantityShipValue);
	setPartNum(partNumValue);
	setPartDesc(partDescValue);
	setSalesTaxRate(salesTaxRateValue);
	setUnitPrice(unitPriceValue);
	setShipCost(shipCostValue);
}											//end Invoice constructor

void Invoice::initialize()
{											//initialzes all values to zero or empty
	Invoice::setInvoiceNum(0);
	Invoice::setQuantityShip(0);
	Invoice::setPartNum(0);
	Invoice::setPartDesc("");
	Invoice::setUnitPrice(0.0);
}
float Invoice::calcTotCost()
{											//finds total cost
	return ((QuantityShip*UnitPrice)+Invoice::calcSalesTaxAm()+ShipCost);
}

float Invoice::calcSalesTaxAm()
{											//finds the amount of sales tax
	return (QuantityShip * UnitPrice * SalesTaxRate);
}

int Invoice::getInvoiceNum()
{
	return InvoiceNum;
}											//end function getInvoiceNum
											//set invoice number
void Invoice::setInvoiceNum(int invoiceNumValue)
{
	InvoiceNum = invoiceNumValue;
}											//end fuction setInvoiceNum

int Invoice::getQuantityShip()
{
	return QuantityShip;
}											//end function getQuantityShip
											//set quantity of item in shipment
void Invoice::setQuantityShip(int quantityShipValue)
{
	QuantityShip = quantityShipValue;
}											//end fuction setQuantityShip

int Invoice::getPartNum()
{
	return PartNum;
}											//end function getPartNum
											//set part number
void Invoice::setPartNum(int partNumValue)
{
	PartNum = partNumValue;
}											//end fuction setPartNum

string Invoice::getPartDesc()
{
	return PartDesc;
}											//end function PartDesc
											//set part description
void Invoice::setPartDesc(string partDescValue)
{
	PartDesc = partDescValue;
}											//end fuction setPartDesc

float Invoice::getSalesTaxRate()
{
	return SalesTaxRate;
}											//end function SalesTaxRate
											//set sales tax rate
void Invoice::setSalesTaxRate(float salesTaxRateValue)
{
	SalesTaxRate = salesTaxRateValue;
}											//end fuction setSalesTaxRate

float Invoice::getUnitPrice()
{
	return UnitPrice;
}											//end function getUnitPrice
											//set unit price
void Invoice::setUnitPrice(float unitPriceValue)
{
	UnitPrice = unitPriceValue;
}											//end fuction setUnitPrice

float Invoice::getShipCost()
{
	return 5.00;
}											//end function ShipCost
											//set shipping cost
void Invoice::setShipCost(float shipCostValue)
{
	ShipCost = shipCostValue;
}											//end fuction setShipCost
void Invoice::print(Invoice *bill)
{											//print values in current bill
	cout<<"Invoice Number: "<<bill.getInvoiceNum<<endl<<endl;
	cout<<"Part Number: "<<bill.getPartNum<<endl;
	cout<<"Part Description: "<<bill.getPartDesc<<endl;
	cout<<"Quantity Shipped: "<bill.getQuantityShip<<endl;
	cout<<"Unit Price ($/item): "<<bill.getUnitPrice<<endl;
	cout<<"Sales Tax Rate: "<<bill.getSalesTaxRate<<endl;
	cout<<"Sales Tax Amount: "<<bill.calcSalesTaxAm<<endl;
	cout<<"Shipping Cost: "<<bill.getShippingCost<<endl;
	cout<<"Total Cost: "<<bill.calcTotCost<<endl;
}
//***********************************************************
//Invoice header file
//Author: Amanda Persons		CSCI 112-001
//Date written: 04 Dec 08
//Class Invoice definition
//************************************************************
#ifndef INV_H
#define INV_H

#include <string>
using namespace std;

class Invoice
{
public:
											//default Invoice constructor
	Invoice(int=0, int=0, int=0, string="", float=0.05, float=0.0, float=5.00);
	void initialize();
	float calcTotCost();
	float calcSalesTaxAm();
											//accessor functions for InvoiceNum
	void setInvoiceNum(int);
	int getInvoiceNum();
											//accessor functions for QuantityShip
	void setQuantityShip(int);
	int getQuantityShip();
											//accessor functions for PartNum
	void setPartNum(int);
	int getPartNum();
											//accessor functions for PartDesc
	void setPartDesc(string);
	string getPartDesc();
											//accessor functions for SalesTaxAm
	void setSalesTaxRate(float);
	float getSalesTaxRate();
											//accessor functions for UnitPrice
	void setUnitPrice(float);
	float getUnitPrice();
											//accessor functions for ShipCost
	void setShipCost(float);
	float getShipCost();

	void print(Invoice *) const;
private:
	int InvoiceNum;
	int QuantityShip;
	int PartNum;
	string PartDesc;
	float UnitPrice;
	float SalesTaxRate;
	float ShipCost;
};

#endif
//***********************************************************
//Invoice Allocation Lab
//Author: Amanda Persons		CSCI 112-001
//Date written: 04 Dec 08
//Allows user to create 10,000 invoices and then edit them
//requires Invoice.h and Invoice.cpp files
//************************************************************

#include <iostream>
#include <string>
using namespace std;
#include "Invoice.h"


int main()
{
	cout<<"This program allows storing and manipulation of invoices."<<endl;
	Invoice *bill = new Invoice[10000];		//dynamically allocates memory for array
	int num = 0;							//holds position in array
	int invnum = 0;							//holds invoice number
	int inum = 0;							//holds integer value
	string str;								//holds string value
	float fnum = 0.0;						//holds float value
	do
	{
		cout<<"Enter invoice number (if you wish to stop, enter 0): ";
		cin>>invnum;						//holds user choice or invoice number
		cout<<endl;
		bill[num].setInvoiceNum(invnum);
		if (invnum > 0)
		{									//begin setting values for current invoice
			cout<<"Enter quantity shipped: ";
			cin>>inum;
			bill[num].setQuantityShip(inum);//sets quantity shipped
			cout<<endl;
			cout<<"Enter part number: ";
			cin>>inum;
			bill[num].setPartNum(inum);		//sets part number
			cout<<endl;
			cout<<"Enter short part description: ";
			cin>>str;
			bill[num].setPartDesc(str);		//sets part description
			cout<<endl;
			cout<<"Enter unit price: ";
			cin>>fnum;
			bill[num].setUnitPrice(fnum);	//sets unit price
			cout<<endl;
		}
		num++;
	}while (inum != 0);						//end do-while loop when user choses
	cout<<"Entering edit mode."<<endl;
	do
	{										//beginning of edit mode
		cout<<"Enter invoice number: ";
		cin>>invnum;						//stores desired invoice number
		int place = 0;						//holds position in array
		bool located = false;				//determines if invoice is found
		if (invnum != 0)
		{									//begin search for invoice
			while((place != (num+1)) && (located != true))
			{
				if (bill[place].getInvoiceNum() == inum)
				{
					located = true;			//found desired invoice
					bill[place].print(bill);
				}
				else
					place++;				//increment position holder
			}
			if (located == true)			//begin editing of current invoice
			{
				int choice = 0;
				cout<<"What would you like to change?"<<endl;
				cout<<"1 - Quantity shipped."<<endl;
				cout<<"2 - Part number."<<endl;
				cout<<"3 - Part description."<<endl;
				cout<<"4 - Unit price."<<endl;
				cout<<"Change number: ";
				cin>>choice;				//hold user choice
				cout<<endl<<"New Value: ";
				switch (choice)				//switch for ediing select portion of invoice
				{
				case 1:						//user choses Quantity shipped
					cin>>inum;
					bill[place].setQuantityShip(inum);
					cout<<endl;
					break;
				case 2:						//user choses Part Number
					cin>>inum;
					bill[place].setPartNum(inum);
					cout<<endl;
					break;
				case 3:						//user choses Part Description
					cin>>str;
					bill[place].setPartDesc(str);
					cout<<endl;
					break;
				case 4:						//user choses Unit Price
					cin>>fnum;
					bill[place].setUnitPrice(fnum);
					break;
				default:					//catch all other inputs
					cout<<"Incorrect choice entered"<<endl;
					break;
				}							//end of switch
			}								//end of
		}									//end of
	} while (invnum != 0);					//end of do-while when user choses
	delete [] bill;
	char exit_char;	                        //Temporary for input           
	cout << "\nPress any key and <enter> to exit \n";
	cin >> exit_char;                       //Wait for key response before exiting.
	return 0;
}											//end main

Several problems
1) add the const keyword

2) need to add () to function method calls

void Invoice::print(Invoice bill) const 
{											//print values in current bill
	cout<<"Invoice Number: "<<bill.getInvoiceNum()<<endl<<endl;
	cout<<"Part Number: "<<bill.getPartNum()<<endl;
	cout<<"Part Description: "<<bill.getPartDesc()<<endl;
	cout<<"Quantity Shipped: "<<bill.getQuantityShip()<<endl;
	cout<<"Unit Price ($/item): "<<bill.getUnitPrice()<<endl;
	cout<<"Sales Tax Rate: "<<bill.getSalesTaxRate()<<endl;
	cout<<"Sales Tax Amount: "<<bill.calcSalesTaxAm()<<endl;
	cout<<"Shipping Cost: "<<bill.getShipCost()<<endl;
	cout<<"Total Cost: "<<bill.calcTotCost()<<endl;
}

In Invoice.h you declare this function:

void print(Invoice) const;

However, I don't think you can use Invoice as a parameter to a class member funtion in the Invoice class delaration because the class hasn't been fully declared yet. You can have a pointer to class type in the class declaration, though. For your purposes I don't think you want either. I'd declare print() to have a void parameter list. It would be used to print() the Invoice invoking it. That is:
Invoice i;
i.print();
will print the Invoice object called i.

But then again, I've been wrong before.

Several problems
1) add the const keyword

2) need to add () to function method calls

void Invoice::print(Invoice bill) const 
{											//print values in current bill
	cout<<"Invoice Number: "<<bill.getInvoiceNum()<<endl<<endl;
	cout<<"Part Number: "<<bill.getPartNum()<<endl;
	cout<<"Part Description: "<<bill.getPartDesc()<<endl;
	cout<<"Quantity Shipped: "<<bill.getQuantityShip()<<endl;
	cout<<"Unit Price ($/item): "<<bill.getUnitPrice()<<endl;
	cout<<"Sales Tax Rate: "<<bill.getSalesTaxRate()<<endl;
	cout<<"Sales Tax Amount: "<<bill.calcSalesTaxAm()<<endl;
	cout<<"Shipping Cost: "<<bill.getShipCost()<<endl;
	cout<<"Total Cost: "<<bill.calcTotCost()<<endl;
}

This just gives me more errors.

c:\documents and settings\tina\my documents\visual studio 2008\projects\csci112lab4\csci112lab4\invoice.cpp(121) : error C2039: 'getShippingCost' : is not a member of 'Invoice'
c:\documents and settings\tina\my documents\visual studio 2008\projects\csci112lab4\csci112lab4\invoice.h(14) : see declaration of 'Invoice'
Generating Code...
Compiling...
main.cpp
c:\documents and settings\tina\my documents\visual studio 2008\projects\csci112lab4\csci112lab4\main.cpp(65) : error C2664: 'Invoice::print' : cannot convert parameter 1 from 'Invoice *' to 'Invoice'
No constructor could take the source type, or constructor overload resolution was ambiguous

Ok, now I'm down to one error in main.

c:\documents and settings\tina\my documents\visual studio 2008\projects\csci112lab4\csci112lab4\main.cpp(65) : error C2664: 'Invoice::print' : cannot convert parameter 1 from 'Invoice *' to 'Invoice'
No constructor could take the source type, or constructor overload resolution was ambiguous

for the line:

bill[place].print(bill);

look at the parameter in the .h file -- it is a pointer. Now look at the parameter in the line you quoted -- that is NOT a pointer. They have to be consistent, one of the two has to be changed.

Ok, now I'm down to one error in main.

c:\documents and settings\tina\my documents\visual studio 2008\projects\csci112lab4\csci112lab4\main.cpp(65) : error C2664: 'Invoice::print' : cannot convert parameter 1 from 'Invoice *' to 'Invoice'
No constructor could take the source type, or constructor overload resolution was ambiguous

for the line:

bill[place].print(bill);

I have tried changing them. it backfires every time. is there any way I could supply an explicit conversion?

oh. sorry. I'm just really trying to get this done in time. I had 5 due tonight (with only 1 1/2 weeks to do them) and I only have 3 completely finished. The last one isn't getting done because I don't have time to type the code up and then compile it and debug. So I need this one to be as good as it can...

sorry about that...

>>
Yes -- you didn't see the code I posted earlier?

Is this in response to supplying an explicit conversion? Because if so, I'm still doing something else wrong because i have the same thing in the code box you provided.

The print() method doesn't need a parameter at all.

This time read all the code and correct the spelling as I did.

Invoice.cpp

void Invoice::print() 
{											//print values in current bill
	cout<<"Invoice Number: "<<getInvoiceNum()<<endl<<endl;
	cout<<"Part Number: "<<getPartNum()<<endl;
	cout<<"Part Description: "<<getPartDesc()<<endl;
	cout<<"Quantity Shipped: "<<getQuantityShip()<<endl;
	cout<<"Unit Price ($/item): "<<getUnitPrice()<<endl;
	cout<<"Sales Tax Rate: "<<getSalesTaxRate()<<endl;
	cout<<"Sales Tax Amount: "<<calcSalesTaxAm()<<endl;
	cout<<"Shipping Cost: "<<getShipCost()<<endl;
	cout<<"Total Cost: "<<calcTotCost()<<endl;
}

invoice.h

void print();

main.cpp

if (bill[place].getInvoiceNum() == inum)

Thanks for replying and all the help you've given me thus far!

Well, when I do that I get 9 occurrences of the same error - one per line.

c:\documents and settings\tina\my documents\visual studio 2008\projects\csci112lab4\csci112lab4\invoice.cpp(114) : error C2662: 'Invoice::getInvoiceNum' : cannot convert 'this' pointer from 'const Invoice' to 'Invoice &'
Conversion loses qualifiers

in main you call print() on an Invoice object just like you call getInvoiceNum() or one of the other plublic methods.

bill[place].print();

assuming you've changed the print() method to have a void parameter list.

Ok, fixed that one. That was my fault for not checking my code exactly. I left const in the .h file.

But...now I'm back to that blasted C2511 error.

c:\documents and settings\tina\my documents\visual studio 2008\projects\csci112lab4\csci112lab4\invoice.cpp(113) : error C2511: 'void Invoice::print(void) const' : overloaded member function not found in 'Invoice'
c:\documents and settings\tina\my documents\visual studio 2008\projects\csci112lab4\csci112lab4\invoice.h(14) : see declaration of 'Invoice'

Did you update the declaration of print() in the .h file and the definition of print() in the .cpp file to correspond with the new signature of print()?

Hey... it works...

stupid const. it didn't save when I built it again... sheesh.

Thanks so much for all of your help!!!!

This article has been dead for over six months. Start a new discussion instead.