简体   繁体   中英

Getting Started with UnitTest++

This is the current code I have from their fundamental example: http://unittest-cpp.sourceforge.net/UnitTest++.html

#include <unittest++/UnitTest++.h>

TEST(FailSpectacularly)
{
    CHECK(false);
}

int main() {
    return UnitTest::RunAllTests();
}

The include exists but I'm receiving errors: undefined reference to UnitTest::Test::* and UnitTest::* where * is some arbitrary class/method within the UnitTest++ library.

How can I get this to compile properly?

Found the answer here: http://comments.gmane.org/gmane.comp.lang.c%2B%2B.unittest%2B%2B.devel/13

Set the library path -L/usr/include and the library -lunittest++

主要供我将来参考,但我最后通过链接到库进行了排序。

g++ test.cpp -lunittest++

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM