HELP! getting unresolved externals error message

Marshall's Avatar, Join Date: Aug 2007
Newbie Member
I'm working on a lab for my C++ class and for some reason i keep getting an 'unresolved externals' error message.

This is a simple program that displays a menu of choices and then displays shapes through function calls. Any help would be appreciated!!!!
Code:
#include <iostream>
#include <iomanip>
#include <string>

using namespace std;


void drawRectangle();
void drawSquare();
void drawRightTriangle();
void drawETriangle();
void drawDiamond();

void main()
{	//start main function

	char choice=0;
	int done=0;
	
	//display menu choices
	//do
	//{
	
	cout<<"Welcome to the shape demonstration program.\n";
	cout<<"Choose one of the menu options below to see a sample of the shape.\n";
	cout<<endl<<endl;
	cout<<setw(5)<<"1.  "<<"Rectangle\n\n";
	cout<<setw(5)<<"2.  "<<"Square\n\n";
	cout<<setw(5)<<"3.  "<<"Right Triangle\n\n";
	cout<<setw(5)<<"4.  "<<"Equilateral Triangle\n\n";
	cout<<setw(5)<<"5.  "<<"Exit the program\n";
	cout<<endl;
	
	
	cin>>choice;
	
	
	switch (choice)					//switch is like nested if statements
		
		
	{								//start switch
		
		
	case '1':
		drawRectangle();
		break;
		
	case '2':
		drawSquare();
		
		break;
		
	case '3':
		drawRightTriangle();
		
		break;
		
	case '4':
		drawETriangle();
		
		break;
		
	case '5':
		done=1;
		break;
		
		
	}							//end switch
	
	
	
	if (!done)
	{							//start compound statement if
		system("PAUSE");
		system("CLS");
		
	}							//end of compound statement
	
	return;
	
}							//end of main



void drawRectangle(int height, int width)				//this function def draws the rectangle

{	
	//note the opening bracket
	//int height, width;
	char symbol;
	int counter;
	
	cout<<"You have chosen the rectangle.  Please enter the desired height and width \n";
	cout<<"of the rectangle separated by a space."<<endl;
	
	cin>>height>>width;
	
	cout<<"You may enter a character of your choice to build this shape.";
	cin>>symbol;
	
	
	for (counter=0; 
	counter < height; 
	counter++)
		
	{								//note the for loops opening bracket
		
		for 
			(int row=0; 
		row < width; 
		row++)
			cout<<'*';
		cout<<endl;
	}									//note the for loops closing bracket
	
}									//note the functions closing bracket




void drawSquare()				//this function def draws the square


{		
	int sqheight, sqwidth, counter, row;
	
	
	cout<<"You have chosen the square.  Please enter the height and width of a square \n";
	cout<<"seperated by a space \n";
	cout<<"For ease of viewing please do not exceed a height or width of 20."<<endl;
	cin>>sqheight>>sqwidth;
	
	
	for (counter=0; 
	counter < sqheight; 
	counter++)
		
	{
		
		for 
			(row=0; 
		row < sqwidth; 
		row++)
			cout<<'0';
		cout<<endl;
	}									//note the for loops closing bracket
	
	
}									//note the functions closing bracket





void drawRightTriangle ()			//this function draws the right triangle

{		
	int rtheight,ilc, olr;
	
	
	cout<<"Please enter the height of the right triangle \n";
	cout<<"For ease of viewing we suggest entering a height less than 20 \n";
	
	cin>>rtheight;
	
	
	for (ilc=0;				//inner loop represents columns. initialize to zero
	ilc < rtheight; 
	ilc++)
		
	{
		
		cout<<'z';
		for
			(olr=0;			//outer loop represents rows. initialize to zero
		ilc!=0 && olr < ilc; 
		olr++)
			cout<<'z';
		cout<<endl;
	}
	
	
	
}								//note the functions closing bracket




void drawETriangle ()				//this function draws the equliateral trianle

{								//starting the function
	
	int eheight,ilc,olr;		//declaring variables
	
	
	cout<<"Please enter the height of the equilateral triangle \n";
	cout<<"For ease of viewing we suggest entering a height less than 20 \n";
	
	cin>>eheight;
	
	
	for (ilc=0;				//inner loop represents columns. initialize to zero
	ilc < eheight; 
	ilc++)
		
	{
		
		cout<<setw(eheight-ilc);
		cout<<'z';
		for
			
			(olr=0;			//outer loop represents rows. initialize to zero
		olr < ilc*2+1; 
		olr++)
			cout<<'z';
		cout<<endl;
	}
	
}

Last edited by shabbir; 6Aug2007 at 22:12.. Reason: Code block - http://www.go4expert.com/forums/misc.php?do=bbcode#code
DaWei's Avatar, Join Date: Dec 2006
Team Leader
Please read the "Before you make a query" thread. You are asking for free help while behaving rudely.
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Quote:
Originally Posted by DaWei
Please read the "Before you make a query" thread. You are asking for free help while behaving rudely.
As of now I have done that for you but try to follow what DaWei has said.
DaWei's Avatar, Join Date: Dec 2006
Team Leader
You have declared a function, void drawRectangle (), and you have called that function. The only similar function you have defined is void drawRectangle (int, int). The linker is unable to find the one you actually call.
Marshall's Avatar, Join Date: Aug 2007
Newbie Member
The definition of rude may be kind of harsh??......

My post was brought on by desparation and as a result i didnt properly check the home page

i was unaware of the protocol - this is my first time visiting this forum. However, i now know the rules and will proceed accordingly.

i'm new to c++ and after spending 4 days on this same error i was ready to pound my head against the wall. surely you can remember the days when you first began coding and have just a smidgen of sympathy
DaWei's Avatar, Join Date: Dec 2006
Team Leader
Hmmmm. I answered your technical question, did I not?

My contention is that a new visitor or member, whether to a church or a forum, should look around and try to determine how things are done. I would never fart, during the sermon, on my first visit to a church. I would not be surprised to discover it was considered rude or thoughtless, should I do so.
Marshall's Avatar, Join Date: Aug 2007
Newbie Member
as mentioned - i now know the rules of the forum.

I would imagine that you have forgiven me just as i would imagine that you dont typically fart in churches (even if it is not your first visit). i would consider it quite rude to boldly pass gas in any public forum.

and yes you did answer my techincal question, thank you

THank you shabir for your assitance as well.