My code and Errors are below, when I Build this I get the unresolved External errors, why? However, when I Compile I don't get any errors...
WHY!?
Code:
#include <iostream.h>
#include <windows.h>
#include <iomanip.h>
double area_(const double&r);
double area_(const double&h,const double&w);
double area_(const double&b1,const double&b2, const double&h);
int full_screen(void);
int kill_cursor(void);
void clrscrn(void);
const double PI = 3.14159265358979323;
int main(int argc, char* argv[])
{
double price=0;
double r=0, height=0, width=0, base1=0, base2=0;
int choice;
clrscrn();
full_screen();
kill_cursor();
cout<<setprecision(2)<<setiosflags(0x1000 | 0x0100);
cout<<"Choose:"<<endl
<<"1. Circular Pizza Calculations.\n"
<<"2. Rectangular Pizza Calculations. \n"
<<"3. Trapazoidal Pizza Calculations. \n"
<<"choice: ";
cin>>choice;
cout<<"\n";
switch(choice)
{
case 1: cout<<"Enter the radius: ";
cin>>r;
cout<<"\n";
price = area_(r);
cout<<"The price per square inch is: "<<price<<endl;
break;
case 2: cout<<"Enter the height: ";
cin>>height;
cout<<"\nEnter the width: ";
cin>>width;
cout<<"\n";
price = area_(height,width);
cout<<"The price per square inch is: "<<price<<endl;
break;
case 3: cout<<"Enter the length of base1: ";
cin>>base1;
cout<<"\nEnter the length of bas2: ";
cin>>base2;
cout<<"\nEnter the height: ";
cin>>height;
cout<<"\n";
price = area_(base1,base2,height);
cout<<"The price per square inch is: "<<price<<endl;
break;
default: cout<<"Not valid choice\n";
}
return 0;
}
double area_(double&r)
{
double price, area1, aPrice;
cout<<"\nEnter the price in for the pizza you paid: ";
cin>>price;
cout<<endl;
area1 = PI * r * r;
aPrice = price / area1;
return aPrice;
}
double area_(double &h, double &w)
{
double price, area1, aPrice;
cout<<"\nEnter the price in for the pizza you paid: ";
cin>>price;
cout<<endl;
area1 = w * h;
aPrice = price / area1;
return aPrice;
}
double area_(double &b1, double &b2, double &h)
{
double price, area1, aPrice;
cout<<"\nEnter the price in for the pizza you paid: ";
cin>>price;
cout<<endl;
area1 = (b1+b2) * h * 0.5;
aPrice = price / area1;
return aPrice;
}
int full_screen()
{
keybd_event(VK_MENU,0x38,0,0);
keybd_event(VK_RETURN,0x1c,0,0);
keybd_event(VK_RETURN,0x1c,KEYEVENTF_KEYUP,0);
keybd_event(VK_MENU,0x38,KEYEVENTF_KEYUP,0);
return 0;
}
int kill_cursor()
{
CONSOLE_CURSOR_INFO cci;
cci.dwSize=1;
cci.bVisible = FALSE;
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cci);
return 0;
}
void clrscrn()
{
COORD coordScreen={ 0, 0};
DWORD cCharsWritten;
CONSOLE_SCREEN_BUFFER_INFO csbi;
DWORD dwConSize;
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
GetConsoleScreenBufferInfo(hConsole, &csbi);
dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
FillConsoleOutputCharacter(hConsole,TEXT(' '), dwConSize, coordScreen, &cCharsWritten);
GetConsoleScreenBufferInfo(hConsole, &csbi);
FillConsoleOutputAttribute(hConsole,csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten);
SetConsoleCursorPosition(hConsole, coordScreen);
}
Code:
--------------------Configuration: homework4 - Win32 Debug--------------------
Compiling...
main.cpp
Linking...
main.obj : error LNK2001: unresolved external symbol "double __cdecl area_(double const &,double const &,double const &)" (?area_@@YANABN00@Z)
main.obj : error LNK2001: unresolved external symbol "double __cdecl area_(double const &,double const &)" (?area_@@YANABN0@Z)
main.obj : error LNK2001: unresolved external symbol "double __cdecl area_(double const &)" (?area_@@YANABN@Z)
Debug/homework4.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.
homework4.exe - 4 error(s), 0 warning(s)