473,387 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Errors in program

Hi all. Ive written a program and there are 2 errors that appear when I
try to compile the program. I dont know how to correct them. Any help
appreciated. Below are the errors

ERROR 1: `cout' undeclared (first use this function)

void marina::OutputList (void) {
// lists the entire list in the marina on the screen
boat * temp;
if (BoatName) {
for (temp=BoatName; temp; temp= temp->next) {
cout << "\n" << temp->BoatName;
cout << " " << temp->BoatLen;
cout << " " << temp->BoatDep;
cout << " " << temp->BoatOwn; }}
else {
//marina empty
cout << "\n\nMarina is empty"; } }
ERROR 2: expected init-declarator before "int" expected `,' or `;'
before "int"

int main()
{

Any help would be great. I can post the entire program on here if that
helps. Thanks

Nov 29 '06 #1
2 6259
On 29 Nov 2006 05:49:36 -0800, "Daz01" <da******@hotmail.comwrote:
>Hi all. Ive written a program and there are 2 errors that appear when I
try to compile the program. I dont know how to correct them. Any help
appreciated. Below are the errors

ERROR 1: `cout' undeclared (first use this function)

void marina::OutputList (void) {
// lists the entire list in the marina on the screen
boat * temp;
if (BoatName) {
for (temp=BoatName; temp; temp= temp->next) {
cout << "\n" << temp->BoatName;
cout << " " << temp->BoatLen;
cout << " " << temp->BoatDep;
cout << " " << temp->BoatOwn; }}
else {
//marina empty
cout << "\n\nMarina is empty"; } }
cout lives in the std namespace: use std::cout. You will have to
include either <ostreamor <iostreamas well if you have not already
done so.
>

ERROR 2: expected init-declarator before "int" expected `,' or `;'
before "int"

int main()
{
You are probably missing a ';' on the line before your main() function
starts.

For very basic questions, alt.comp.lang.learn.c-c++ might be a better
bet.

rossum
>Any help would be great. I can post the entire program on here if that
helps. Thanks
Nov 29 '06 #2
On 2006-11-29 14:49, Daz01 wrote:
Hi all. Ive written a program and there are 2 errors that appear when I
try to compile the program. I dont know how to correct them. Any help
appreciated. Below are the errors

ERROR 1: `cout' undeclared (first use this function)

void marina::OutputList (void) {
// lists the entire list in the marina on the screen
boat * temp;
if (BoatName) {
for (temp=BoatName; temp; temp= temp->next) {
cout << "\n" << temp->BoatName;
cout << " " << temp->BoatLen;
cout << " " << temp->BoatDep;
cout << " " << temp->BoatOwn; }}
else {
//marina empty
cout << "\n\nMarina is empty"; } }
ERROR 2: expected init-declarator before "int" expected `,' or `;'
before "int"
Since I don't have the whole code I can't say for sure, but it sounds
like you have forgotten a ; before the main()-function (that's probably
where the 'int' comes from).

A tip: Try to put your '}' on their own lines, it was not apparent at
first that you had not forgotten one.

--

Erik Wikström
Nov 29 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: SM | last post by:
Hi, While linking orbix C++ application, we get a lot of linking errors. Few errors are pasted below. If someone could tell us which are the libraries that need to be added, it would be of help....
2
by: Kavitha Rao | last post by:
Hi, I am getting the following errors while trying to run this snippet in Microsoft Visual C++.Can't seem to print the crc value stored. /* +++Date last modified: 05-Jul-1997 */ /* Crc - 32...
4
by: atv | last post by:
Whatis the proper way to handle errors from function calls? For example, i normally have a main function, with calls to mine or c functions. Should i check for errors in the functions called...
0
by: JW | last post by:
I'm using MSVC7.0 and I'm getting a ton of errors with most of them occurring in cstdio. Any thoughts as to what might cause this? d:\Program Files\Microsoft Visual Studio .NET\Vc7...
2
by: Z.K. | last post by:
I am new to the Visual Studio.net platform and I was trying to compile a program that I downloaded from the net and keep getting a ton of errors. It looks like it can't find some of the libraries:...
5
by: Eric_Dexter | last post by:
I was trying to add this to my project but I must be missing some includes or there is a serius error somewhere Anthra Norell wrote:
8
by: ftjonsson | last post by:
hello, I was wondering if anyone could tips me on what I am doing wrong when writing the following code: #include <iostream> using namespace std; int main () {
4
by: daivdh | last post by:
I recently tried to download and install a Gadget called "Piano" which would put a piano keyboard on the screen. It downloaded and installed okay. When I dragged the keyboard from the sidebar onto...
6
by: aureao4 | last post by:
I'm new to Java and programming. I'm trying to code a payroll program and continue getting errors. The program worked last week, this week I have to add set, get and a class. I've written the class...
5
by: tcby16 | last post by:
I am supposed to use two classes to perform one of three math operations depending on the user's choice. Use if statements to allow the user to choose which math operation to execute. So I created...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.