Hey everyone, this is my first post so hopefully someone can help me. I've tried almost everything with this code and nothing's been working. Technically it is homework, but the point of the assignment was to find and fix errors, and trust me it was a lot uglier than this before i started on it :P. So I'm just wondering if I'm completely blind on this one or if it's a legitimate problem. Here's the code:
And the following is the build message:Code:#include<iostream>
#include<conio.h>
using namespace std;
class Circle
{
public:
int radius;
void printArea();
void printDiameter();
};
double radius;
void main()
{
void printArea(Circle);
void printDiameter(Circle);
Circle aBigCircle, aLittleCircle;
aBigCircle.radius = 50;
aLittleCircle.radius = 4;
printArea(aBigCircle);
printDiameter(aBigCircle);
printArea(aLittleCircle);
printDiameter(aLittleCircle);
std::cin.clear();
std::cin.ignore();
getchar();
}
void Circle::printArea()
{
double area;
area = radius * radius * 3.14159;
cout<<"A circle with radius "<<radius<<" has an area of "<<area<<endl;
}
void Circle::printDiameter()
{
double diam;
diam = radius * 2;
cout<<"A circle with radius "<<radius<<" has a diameter of "<<diam<<endl;
}
1>------ Build started: Project: Lab 4, Configuration: Debug Win32 ------
1>Build started 04/02/2011 2:06:57 PM.
1>InitializeBuildStatus:
1> Touching "Debug\Lab 4.unsuccessfulbuild".
1>ClCompile:
1> asdf.cpp
1>Link:
1> LINK : C:\Users\-------\Documents\Visual Studio 2010\Projects\Lab 4\Debug\Lab 4.exe not found or not built by the last incremental link; performing full link
1>asdf.obj : error LNK2019: unresolved external symbol "void __cdecl printDiameter(class Circle)" (?printDiameter@@YAXVCircle@@@Z) referenced in function _main
1>asdf.obj : error LNK2019: unresolved external symbol "void __cdecl printArea(class Circle)" (?printArea@@YAXVCircle@@@Z) referenced in function _main
1>C:\Users\-------\Documents\Visual Studio 2010\Projects\Lab 4\Debug\Lab 4.exe : fatal error LNK1120: 2 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:02.61
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Seriously, any help would be fantastic. Also, this isn't a last resort kind of thing, it's not like it's due tomorrow. I've been working on it for 3 days and I'm dead stuck. Thanks for any future help :)
Adam