문제

When building a test with QTestLib, I get an "undefined symbols" error for a qCompare function:

Undefined symbols for architecture x86_64:
  "__ZN5QTest8qCompareIimEEbRKT_RKT0_PKcS8_S8_i", referenced from:
      __ZN15MyTestClass22myTestFunctionEv in MyTestClass.o
도움이 되었습니까?

해결책

You can decipher the mangled symbol by passing it through c++filt in a shell command:

echo __ZN5QTest8qCompareIimEEbRKT_RKT0_PKcS8_S8_i | c++filt

... which prints a C++ function signature like this:

bool QTest::qCompare<int, unsigned long>(int const&, unsigned long const&, char const*, char const*, char const*, int)

The two arguments to the QCOMPARE macro — i.e., the two template arguments to the qCompare function — must have exactly the same type. You get an error, for example, if one is an int and the other is a size_t.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top