It's been a while since I've used c++ much and now I'm enountering an annoying problem. It's probably some simple syntax issue (either that or the compiler is broken, but it's never really that.. ). I've looked over various things and I can't see what's wrong....I think I'm just too involved at this point and I need a second opinion.
The problem is that the linker can't seem to find any methods within the class. I'm using gcc 2.95 and I 3.1....I get the same thing with both.
The errors are:
testy.cpp: undefined reference to `test::test(void)'
testy.cpp: undefined reference to `test::nowork(void)'
(I trimmed off the full path)
This is my code:
test.h
Code:
class test {
public:
test();
void nowork();
};
test.cpp
Code:
#include <iostream>
#include "test.h"
using namespace std;
test::test() {
}
void test::nowork() {
int useless;
cout << "hi there!\n";
}
testy.cpp (driver)
Code:
#include "test.h"
#include <iostream>
int main() {
test will;
will.nowork();
}
Any help you can give would be appreciated, thanks.