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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With