0
我不确定要理解我得到的未定义的引用。当我运行cxxtest时,我得到一个未定义的引用错误
./cxxtest/cxxtestgen.py -o tests.cpp --error-printer DrawTestSuite.h
g++ -I./cxxtest/ -c tests.cpp
g++ -o tests tests.o Color.o
tests.o: In function `DrawTestSuite::testLinewidthOne()':
tests.cpp:(.text._ZN13DrawTestSuite16t… undefined reference to `Linewidth::Linewidth(double)'
tests.cpp:(.text._ZN13DrawTestSuite16t… undefined reference to `Linewidth::draw(std::basic_ostream<char… std::char_traits<char> >&)'
collect2: ld returned 1 exit status
make: *** [tests] Error 1// DrawTestSuite.h
DrawTestSuite.h包含单元测试和测试函数调用Linewidth.h来执行构造函数和成员函数的绘制。
我在DrawTestSuite.h中有#include "Linewidth.h"
。
+1。第三行应该是'g ++ -o tests tests.o Color.o Linewidth.o' – 2010-04-14 06:58:45
@Draco:这就是显示正在执行的命令,并且可以生成makefile。 (如果不是,只需包含适当的“tests:Linewidth.o”规则,即添加“Linewidth.o”作为依赖项。) – 2010-04-14 07:01:35
我知道它是makefile :) – 2010-04-14 07:12:46