I'm trying to do something (as a C++ noob) that I thought should be easy: reference one class from another. For some reason, I'm getting an error:
Error 6 error LNK2019: unresolved external symbol "public: float * __thiscall Foo::Test(void)" (?Test@Foo@@QAEPAMXZ) referenced in function "void __cdecl Test(void)" (?Test@@YAXXZ) Bar.obj
Foo.h
class Foo
{
public:
Foo(void);
~Foo(void);
float* Test();
};
Foo.cpp
#include "Foo.h"
float* Test()
{
return new float[0];
}
Bar.h
class Bar
{
public:
Bar(void);
~Bar(void);
void Test();
};
Bar.cpp
#include "Bar.h"
#include "Foo.h"
void Test()
{
Foo* foo = new Foo();
foo->Test();
}
Why won't the compiler let me reference the class Foo from Bar? I have no idea what this error means, nor any clue how to debug it.