0

I am trying to write boost unit tests for a C++ repository. I want to assert the return values of the function, but the visual studio complains it as an unresolved external symbol. If the BOOST_AUTO_TEST_CASE(my_boost_test) uses user-defined types in the repository, there are no issues, but as I use a function, then there are unresolved external symbol issues.

The below test runs without any error, but if I uncomment that function call, then I get an unresolved external symbol issue. Am I using a wrong BOOST_TEST? How to use a function call in the boost unit tests?

#include <boost/test/included/unit_test.hpp>
#include "../my_repo/graph.h" // (getLables(), labelGraph and vertex_t defined here)

BOOST_AUTO_TEST_CASE(my_boost_test)
{
  std::string file1("test_tring");
  //vector<std::string> records = getLabels(file1);
  labelGraph g;
  vertex_t root = boost::add_vertex(g);
  g[root].name = ".";
  BOOST_TEST(1 == 1);
  BOOST_TEST(true);
}

1 Answers1

0

The issue is with Visual studio. my_repo was built as a console application in which case there were no .lib files generated. Changing the my_repo from console application to static library output resolved the issues.