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