Connecting Tech Pros Worldwide Help | Site Map

Confusing Error Message

 
LinkBack Thread Tools Search this Thread
  #1  
Old March 23rd, 2007, 05:35 PM
Wilson
Guest
 
Posts: n/a
Default Confusing Error Message

Hi, while writing a simplified version of a program i created the
following class, however when i went to compile and run the program
there was an error saying

"multiple types in one declaration" and there was a mention of a
"[Build Error]" and "Error 1"

it also highlights the final line (the one with a closing brace and
semi-colon), i cannot see what is wrong with this, please help

wilson

class checking : public Account
{
friend void new_account();
public:
int abc;
};


  #2  
Old March 23rd, 2007, 05:55 PM
Marcus Kwok
Guest
 
Posts: n/a
Default Re: Confusing Error Message

Wilson <tpwils@googlemail.comwrote:
Quote:
Hi, while writing a simplified version of a program i created the
following class, however when i went to compile and run the program
there was an error saying
>
"multiple types in one declaration" and there was a mention of a
"[Build Error]" and "Error 1"
>
it also highlights the final line (the one with a closing brace and
semi-colon), i cannot see what is wrong with this, please help
>
wilson
>
class checking : public Account
{
friend void new_account();
public:
int abc;
};
You have not provided enough information to diagnose your problem. See
http://www.parashift.com/c++-faq-lit...t.html#faq-5.8
for guidelines on how to post code that doesn't work.

--
Marcus Kwok
Replace 'invalid' with 'net' to reply
  #3  
Old March 23rd, 2007, 06:45 PM
Wilson
Guest
 
Posts: n/a
Default Re: Confusing Error Message

On Mar 23, 5:48 pm, ricec...@gehennom.invalid (Marcus Kwok) wrote:
Quote:
Wilson <tpw...@googlemail.comwrote:
Quote:
Hi, while writing a simplified version of a program i created the
following class, however when i went to compile and run the program
there was an error saying
>
Quote:
"multiple types in one declaration" and there was a mention of a
"[Build Error]" and "Error 1"
>
Quote:
it also highlights the final line (the one with a closing brace and
semi-colon), i cannot see what is wrong with this, please help
>
Quote:
wilson
>
Quote:
class checking : public Account
{
friend void new_account();
public:
int abc;
};
>
You have not provided enough information to diagnose your problem. Seehttp://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.8
for guidelines on how to post code that doesn't work.
>
--
Marcus Kwok
Replace 'invalid' with 'net' to reply- Hide quoted text -
>
- Show quoted text -
sorry. the operating system is windows using Dev c++ and below is the
whole code, main() only includes a simple function call for one of the
classes which causes no problems. the full error message says "[Build
error] multiple types in one decleration "error 1" "

#include <iostream>
#include <time.h>
#include <fstream>
using namespace std;

class Account
{
public:
virtual void returnbalance(){ cout << balance; }
virtual void deposit(float amount)
{
balance += amount;
std::cout << "$" << amount << " Has Been Added To
Your Account" << std::endl;
}
virtual void withdraw(float amount)
{
if (balance amount)
{
balance -= amount;
std::cout << "$" << amount << " Has Been
Withdrawn From Your Account" << std::endl;
}
else
{
std::cout << "Insufficient Funds" << std::endl;
}
}
protected:
float balance;
int pin_number;
int account_number;
}
///////////////////////////////////////////////////////
class checking : public Account
{
friend void new_account();
public:
int abc;
};
///////////////////////////////////////////////////////
class savings : public Account
{
friend void new_account();
public:
virtual void withdraw(float amount)
{
if (balance amount && balance >= 200)
{
balance -= amount;
std::cout << "$" << amount << " Has Been
Withdrawn From Your Account";
if(amount >= 500)
{
balance = balance - 5;
std::cout << ", however a charge of $5
has been applied" << std::endl;
}
}
else
{
std::cout << "Insufficient Funds" << std::endl;
}
}
protected:
int numberofaccounts;
};


  #4  
Old March 23rd, 2007, 07:35 PM
Jim Langston
Guest
 
Posts: n/a
Default Re: Confusing Error Message


"Wilson" <tpwils@googlemail.comwrote in message
news:1174675157.568013.79300@n76g2000hsh.googlegro ups.com...
Quote:
On Mar 23, 5:48 pm, ricec...@gehennom.invalid (Marcus Kwok) wrote:
Quote:
>Wilson <tpw...@googlemail.comwrote:
Quote:
Hi, while writing a simplified version of a program i created the
following class, however when i went to compile and run the program
there was an error saying
>>
Quote:
"multiple types in one declaration" and there was a mention of a
"[Build Error]" and "Error 1"
>>
Quote:
it also highlights the final line (the one with a closing brace and
semi-colon), i cannot see what is wrong with this, please help
>>
Quote:
wilson
>>
Quote:
class checking : public Account
{
friend void new_account();
public:
int abc;
};
>>
>You have not provided enough information to diagnose your problem.
>Seehttp://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.8
>for guidelines on how to post code that doesn't work.
>>
>--
>Marcus Kwok
>Replace 'invalid' with 'net' to reply- Hide quoted text -
>>
>- Show quoted text -
>
sorry. the operating system is windows using Dev c++ and below is the
whole code, main() only includes a simple function call for one of the
classes which causes no problems. the full error message says "[Build
error] multiple types in one decleration "error 1" "
>
#include <iostream>
#include <time.h>
#include <fstream>
using namespace std;
>
class Account
{
public:
virtual void returnbalance(){ cout << balance; }
virtual void deposit(float amount)
{
balance += amount;
std::cout << "$" << amount << " Has Been Added To
Your Account" << std::endl;
}
virtual void withdraw(float amount)
{
if (balance amount)
{
balance -= amount;
std::cout << "$" << amount << " Has Been
Withdrawn From Your Account" << std::endl;
}
else
{
std::cout << "Insufficient Funds" << std::endl;
}
}
protected:
float balance;
int pin_number;
int account_number;
}
Missing ; here. Should be
};
Quote:
///////////////////////////////////////////////////////
class checking : public Account
{
friend void new_account();
public:
int abc;
};
///////////////////////////////////////////////////////
class savings : public Account
{
friend void new_account();
public:
virtual void withdraw(float amount)
{
if (balance amount && balance >= 200)
{
balance -= amount;
std::cout << "$" << amount << " Has Been
Withdrawn From Your Account";
if(amount >= 500)
{
balance = balance - 5;
std::cout << ", however a charge of $5
has been applied" << std::endl;
}
}
else
{
std::cout << "Insufficient Funds" << std::endl;
}
}
protected:
int numberofaccounts;
};
Fix was in line. Scroll up, you were missing a ; after your definition of
class Account


  #5  
Old March 23rd, 2007, 08:05 PM
Kenneth
Guest
 
Posts: n/a
Default Re: Confusing Error Message

On Mar 23, 2:39 pm, "Wilson" <tpw...@googlemail.comwrote:
Quote:
On Mar 23, 5:48 pm, ricec...@gehennom.invalid (Marcus Kwok) wrote:
>
>
>
>
>
Quote:
Wilson <tpw...@googlemail.comwrote:
Quote:
Hi, while writing a simplified version of a program i created the
following class, however when i went to compile and run the program
there was an error saying
>
Quote:
Quote:
"multiple types in one declaration" and there was a mention of a
"[Build Error]" and "Error 1"
>
Quote:
Quote:
it also highlights the final line (the one with a closing brace and
semi-colon), i cannot see what is wrong with this, please help
>
Quote:
Quote:
wilson
>
Quote:
Quote:
class checking : public Account
{
friend void new_account();
public:
int abc;
};
>
Quote:
You have not provided enough information to diagnose your problem. Seehttp://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.8
for guidelines on how to post code that doesn't work.
>
Quote:
--
Marcus Kwok
Replace 'invalid' with 'net' to reply- Hide quoted text -
>
Quote:
- Show quoted text -
>
sorry. the operating system is windows using Dev c++ and below is the
whole code, main() only includes a simple function call for one of the
classes which causes no problems. the full error message says "[Build
error] multiple types in one decleration "error 1" "
>
#include <iostream>
#include <time.h>
#include <fstream>
using namespace std;
>
class Account
{
public:
virtual void returnbalance(){ cout << balance; }
virtual void deposit(float amount)
{
balance += amount;
std::cout << "$" << amount << " Has Been Added To
Your Account" << std::endl;
}
virtual void withdraw(float amount)
{
if (balance amount)
{
balance -= amount;
std::cout << "$" << amount << " Has Been
Withdrawn From Your Account" << std::endl;
}
else
{
std::cout << "Insufficient Funds" << std::endl;
}
}
protected:
float balance;
int pin_number;
int account_number;}
>
///////////////////////////////////////////////////////
class checking : public Account
{
friend void new_account();
public:
int abc;};
>
///////////////////////////////////////////////////////
class savings : public Account
{
friend void new_account();
public:
virtual void withdraw(float amount)
{
if (balance amount && balance >= 200)
{
balance -= amount;
std::cout << "$" << amount << " Has Been
Withdrawn From Your Account";
if(amount >= 500)
{
balance = balance - 5;
std::cout << ", however a charge of $5
has been applied" << std::endl;
}
}
else
{
std::cout << "Insufficient Funds" << std::endl;
}
}
protected:
int numberofaccounts;
>
>
>
};- Hide quoted text -
>
- Show quoted text -- Hide quoted text -
>
- Show quoted text -
You're missing a semicolon at the end of one of your class
definitions. Classes definitions must have a semicolon after the
closing bracket.

  #6  
Old March 23rd, 2007, 08:25 PM
dave_mikesell@fastmail.fm
Guest
 
Posts: n/a
Default Re: Confusing Error Message

Also, "pin_number" is redundant.

Just sayin...

  #7  
Old March 23rd, 2007, 08:35 PM
Default User
Guest
 
Posts: n/a
Default Re: Confusing Error Message

dave_mikesell@fastmail.fm wrote:
Quote:
Also, "pin_number" is redundant.
>
Just sayin...
It's that thing you enter into the ATM machine.



Brian
  #8  
Old March 23rd, 2007, 09:15 PM
Marcus Kwok
Guest
 
Posts: n/a
Default Re: Confusing Error Message

Default User <defaultuserbr@yahoo.comwrote:
Quote:
dave_mikesell@fastmail.fm wrote:
>
Quote:
>Also, "pin_number" is redundant.
>>
>Just sayin...
>
It's that thing you enter into the ATM machine.
PIN = Personal Identification Number
PIN Number = Personal Identification Number Number

See RAS syndrome (Redundant Acronym Syndrome syndrome):
http://en.wikipedia.org/wiki/RAS_syndrome

--
Marcus Kwok
Replace 'invalid' with 'net' to reply
  #9  
Old March 23rd, 2007, 10:15 PM
Default User
Guest
 
Posts: n/a
Default Re: Confusing Error Message

Marcus Kwok wrote:
Quote:
Default User <defaultuserbr@yahoo.comwrote:
Quote:
dave_mikesell@fastmail.fm wrote:
Quote:
Also, "pin_number" is redundant.
>
Just sayin...
It's that thing you enter into the ATM machine.
>
PIN = Personal Identification Number
PIN Number = Personal Identification Number Number
ATM == Automatic Teller Machine machine.




Brian
  #10  
Old March 24th, 2007, 01:05 AM
Mike Wahler
Guest
 
Posts: n/a
Default Re: Confusing Error Message


"Wilson" <tpwils@googlemail.comwrote in message
news:1174671198.718143.65370@e1g2000hsg.googlegrou ps.com...
Quote:
Hi, while writing a simplified version of a program i created the
following class, however when i went to compile and run the program
there was an error saying
>
"multiple types in one declaration" and there was a mention of a
"[Build Error]" and "Error 1"
>
it also highlights the final line (the one with a closing brace and
semi-colon), i cannot see what is wrong with this, please help
>
wilson
>
class checking : public Account
{
friend void new_account();
public:
int abc;
};
The error almost certainly is caused by something
in the portion of code you did not post.

-Mike


  #11  
Old March 24th, 2007, 05:05 AM
Jim Langston
Guest
 
Posts: n/a
Default Re: Confusing Error Message

"Default User" <defaultuserbr@yahoo.comwrote in message
news:56j1nkF29ip9vU1@mid.individual.net...
Quote:
Marcus Kwok wrote:
>
Quote:
>Default User <defaultuserbr@yahoo.comwrote:
Quote:
dave_mikesell@fastmail.fm wrote:
>
>Also, "pin_number" is redundant.
>>
>Just sayin...
>
It's that thing you enter into the ATM machine.
>>
>PIN = Personal Identification Number
>PIN Number = Personal Identification Number Number
>
ATM == Automatic Teller Machine machine.
You're the one who called it "ATM machine." I, and everyone I know, just
call it an ATM. As in, "Do you know where an ATM is?"

Incidently, I used to work for a company called ATM. Thought it would cool
working on ATMs. Turns out they made speaker racks for concerts :/


  #12  
Old March 26th, 2007, 05:55 PM
Marcus Kwok
Guest
 
Posts: n/a
Default Re: Confusing Error Message

Default User <defaultuserbr@yahoo.comwrote:
Quote:
Marcus Kwok wrote:
>
Quote:
>Default User <defaultuserbr@yahoo.comwrote:
Quote:
dave_mikesell@fastmail.fm wrote:
>
>Also, "pin_number" is redundant.
>>
>Just sayin...
>
It's that thing you enter into the ATM machine.
>>
>PIN = Personal Identification Number
>PIN Number = Personal Identification Number Number
>
ATM == Automatic Teller Machine machine.
Nice one, except we call ATM machines "At The Moment machines" :)
(just kidding, but not really)

--
Marcus Kwok
Replace 'invalid' with 'net' to reply
  #13  
Old March 28th, 2007, 12:15 AM
Old Wolf
Guest
 
Posts: n/a
Default Re: Confusing Error Message

On Mar 24, 5:04 pm, "Jim Langston" <tazmas...@rocketmail.comwrote:
Quote:
You're the one who called it "ATM machine." I, and everyone I know, just
call it an ATM. As in, "Do you know where an ATM is?"
I wonder if their back end runs with Microsoft MTS Transaction Server


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.