pls help me with this c++ error
I wrote a program in vc++ 2008 and i am getting the following error:
1>Linking...
1>overloading -.obj : error LNK2019: unresolved external symbol "public: void __thiscall space::display(void)" (?display@space@@QAEXXZ) referenced in function _main
1>G:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\overloading\Debug\overloading.exe : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://g:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\overloading\overloading\Debug\BuildLog.htm"
how do i solve it.....pls tell its urgent....
You've added a function to the class 'space' named 'display'... but you didn't implement the function in a CPP file?
neerajshastry, can you hear us?
*sigh*
Quote:MikeTacular
neerajshastry, do you ever google your questions before you ask them? Because you should. Always.
*sigh*
here is the code for reference
#include <iostream>
using namespace std;
class space
{
int x;
int y;
int z;
public:
void getdata(int a,int b,int c);
void display(void);
void operator-();
};
void space ::getdata(int a, int b, int c)
{
x = a;
y = b;
z = c;
}
void space ::operator -()
{
x = -x;
y = -y;
z = -z;
}
int main()
{
space S;
S.getdata(10,-20,30);
cout << "S : ";
S.display();
return 0;
}
#include <iostream>
using namespace std;
class space
{
int x;
int y;
int z;
public:
void getdata(int a,int b,int c);
void display(void);
void operator-();
};
void space ::getdata(int a, int b, int c)
{
x = a;
y = b;
z = c;
}
void space ::operator -()
{
x = -x;
y = -y;
z = -z;
}
int main()
{
space S;
S.getdata(10,-20,30);
cout << "S : ";
S.display();
return 0;
}
Quote:Original post by Hodgman
You've added a function to the class 'space' named 'display'... but you didn't implement the function in a CPP file?
!
Quote:Original post by neerajshastry
thanks Dragon0 i got my problem solved
See, you don't even read all posts, do you? Hodgman was the one giving you an answer, and Dragon0 emphasized it.
And I don't believe you that you have tried google yet. Because, I get tons of proper solutions: teh googles, they do nuzzing.
edit: Oh, and if you ever post code again, then you might want to use proper tags. Posting code as plain text is often regarded impolite on every programming forum: gd.net supported tags and text formatting.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement