I have a project and want to use google test, I think I followed the steps from this tutorial but it doesn't work.
For example, trying
#include "pch.h"
#include "../../common/units.h"
#include "gtest/gtest.h"
TEST(TestCaseName, TestName) {
VTile v(17, 16);
EXPECT_EQ(v.x, 17);
}
leads to an LNK2019: unresolved external symbol "public: __thiscall VTile::VTile(float const &,float const &)" (??0VTile@@QAE@ABM0@Z) referenced in function "private: virtual void __thiscall TestCaseName_TestName_Test::TestBody(void)" (?TestBody@TestCaseName_TestName_Test@@EAEXXZ) tests C:\Users_\Desktop_\src\client\tests\test.obj 1
But this compiles (and the test runs, and fails, which is normal)
#include "pch.h"
#include "../../common/units.h"
#include "gtest/gtest.h"
TEST(TestCaseName, TestName) {
VTile v;
EXPECT_EQ(v.x, 17);
}
Why can I include the header and use the default constructor (made VTile() = default in header) but not any methods defined in the .cpp? its like this for all of my files, anything in the header is fine, cpp is not.
Why does it not find the definitions?