Say I had the following code:
Test.h
Code:
class test
{
public:
test();
~test();
void dis();
};
Test.cpp
Code:
#include <iostream>
#include "Test.h"
test::test()
{
}
test::~test()
{
}
void test::dis()
{
std::cout<<"Hello";
}
main.cpp
Code:
#include <iostream>
#include <stdlib.h>
#include "Test.h"
using namespace std;
int main()
{
test a;
a.dis();
system("PAUSE");
return 0;
}
Each time i try to compile main.cpp it dosn't compile and my compiler just says:
c:\windows\TEMP\cc1l***b.o(.text+0x29):main.cpp: undefined reference to `test::test(void)'
c:\windows\TEMP\cc1l***b.o(.text+0x40):main.cpp: undefined reference to `test::~test(void)'
c:\windows\TEMP\cc1l***b.o(.text+0x57):main.cpp: undefined reference to `test::dis(void)'
c:\windows\TEMP\cc1l***b.o(.text+0x86):main.cpp: undefined reference to `test::~test(void)'
What's going on?