1

Basic Info Hi, I use VS2017 and I want to add Google Test to my project. I thought that it works because I added few tests like that:

    /**
* @brief UtilitiesTest -> Utilities.hpp -> convertToUnitPosition test
*/
TEST(UtilitiesTest, convertToUnitPosition)
{
    sf::Vector2f pxPos = { 100,100 };
    sf::Vector2f cellDim = { 25,25 };

    auto uPos = Utilities::convertToUnitPosition(pxPos, cellDim);
    EXPECT_TRUE(uPos.x == 4);
    EXPECT_TRUE(uPos.y == 4);

    pxPos = { 99,100 };
    uPos = Utilities::convertToUnitPosition(pxPos, cellDim);

    EXPECT_TRUE(uPos.x == 3);
    EXPECT_TRUE(uPos.y == 4);
}

and this works, but when I add the next test:

  TEST(UtilitiesTest, isInWindow)
{
    auto scene = std::make_shared<Scene>("GTest", sf::Vector2f(200, 200));
}

Now I have got this error:

    Severity    Code    Description Project File    Line    Suppression State
Error   LNK2019 unresolved external symbol "public: __thiscall Scene::Scene(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class sf::Vector2<float> const &)" (??0Scene@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV?$Vector2@M@sf@@@Z) referenced in function "public: __thiscall std::_Ref_count_obj<class Scene>::_Ref_count_obj<class Scene><char const (&)[6],class sf::Vector2<float> >(char const (&)[6],class sf::Vector2<float> &&)" (??$?0AAY05$$CBDV?$Vector2@M@sf@@@?$_Ref_count_obj@VScene@@@std@@QAE@AAY05$$CBD$$QAV?$Vector2@M@sf@@@Z)  GTest   

How I added GTest to project 1. Add new project to solution 2. Choose Google Test 3. static libary / link dynamically 4. I added SFML propeties to project (because I am using SFML)

Problem Some of my own classes and methods works, other does not and I am so confused because I try a lot of ways from stack and It does not help me.

mvxxx
  • 115
  • 9

0 Answers0