首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ubuntu 14.04中使用cpputest的tdd make error

ubuntu 14.04中使用cpputest的tdd make error
EN

Stack Overflow用户
提问于 2015-07-02 07:46:33
回答 1查看 867关注 0票数 1

我正在尝试学习cpputest,所以转到cpputest手册,将以下代码复制到我的ubuntu 14.04lts笔记本电脑中,并尝试制作。我刚开始写文件,我遇到了一堆错误--我该如何纠正我的代码呢?

代码语言:javascript
复制
#include "CppUTest/TestHarness.h"
#include "CppUTest/TestOutput.h"

TEST_GROUP(FirstTestGroup)
{
};

TEST(FirstTestGroup, FirstTest)
{
    FAIL("Fail me!");
}

TEST(FirstTestGroup, SecondTest)
{
   STRCMP_EQUAL("hello", "world");
   LONGS_EQUAL(1, 2);
   CHECK(false);
}

这就是test.cpp,我有一个名为test_main.cpp的main

代码语言:javascript
复制
#include "CppUTest/CommandLineTestRunner.h"

int main(int argc, char** argv)
{
   return CommandLineTestRunner::RunAllTests(argc, argv);
}

make文件是:

代码语言:javascript
复制
all: test
export CPPUTEST_HOME=/usr/share/cpputest
CPPFLAGS += -I$(CPPUTEST_HOME)/include 
LD_LIBRARIES = -L$(CPPUTEST_HOME)/lib -lCppUTest -lCppUTestExt

test: test_main.o test.o
    g++ -o mytest test.o test_main.o
test_main.o: test_main.cpp 
    g++ -c test_main.cpp $(CPPFLAGS) 
test.o: test.cpp 
    g++ -c test.cpp  $(CPPFLAGS) $(LD_LIBRARIES)
    #g++ -C -o test_main.o test_main.cpp test.o test.cpp $(CPPFLAGS) 
    #g++ -o mytest tet_main.o test.o $(LD_LIBRARIES)

clean:
    rm -f *.o mytest

当我说make时,我得到了一堆错误。

请在这方面帮助我

EN

回答 1

Stack Overflow用户

发布于 2015-07-03 00:38:20

代码语言:javascript
复制
I changed the my makefile as follows: after the changes it worked

all: mytest
export CPPUTEST_HOME=/usr/local
CPPFLAGS += -I$(CPPUTEST_HOME)/include 
LD_LIBRARIES = -L$(CPPUTEST_HOME)/lib -lCppUTest -lCppUTestExt

mytest: test_main.o test.o
    g++ -g -o mytest test.o test_main.o $(LD_LIBRARIES)
test_main.o: test_main.cpp 
    g++ -g $(CPPFLAGS) -c test_main.cpp
test.o: test.cpp 
    g++ -g $(CPPFLAGS) -c test.cpp
clean:
    rm -f *.o mytest
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31173460

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档