これは私のメイクファイルです:
#Makefile
CC=g++
CFLAGS=-lcppunit
OBJS=Money.o MoneyTest.o
all : $(OBJS)
$(CC) $(OBJS) -o TestUnitaire
#création des objets
Money.o: Money.cpp Money.hpp
$(CC) -c Money.cpp $(CFLAGS)
MoneyTest.o: MoneyTest.cpp Money.hpp MoneyTest.hpp
$(CC) -c MoneyTest.cpp $(CFLAGS)
clean:
rm *.o $(EXEC)
このメイクファイルを実行すると、次のようなエラーが発生します。
g++ Money.o MoneyTest.o -o TestUnitaire Money.o: 関数内
main': Money.cpp:(.text+0x3c): undefined reference to
CppUnit::TestFactoryRegistry::getRegistry(std::basic_string, std::allocator > const&)' Money.cpp:(.text+0x78): 未定義の参照CppUnit::TextTestRunner::TextTestRunner(CppUnit::Outputter*)' Money.cpp:(.text+0x8c): undefined reference to
CppUnit::TestRunner::addTest(CppUnit::Test*)' Money.cpp:(.text+0x98):CppUnit::TextTestRunner::result() const' Money.cpp:(.text+0xec): undefined reference to
CppUnit::CompilerOutputter::CompilerOutputter(CppUnit::TestResultCollector*, std::basic_ostream への未定義参照 > & , std::basic_string, std::allocator > const&)' Money.cpp:(.text+0xfc):CppUnit::TextTestRunner::setOutputter(CppUnit::Outputter*)' Money.cpp:(.text+0x168): undefined reference to
CppUnit::TextTestRunner::run への未定義の参照(std::basic_string, std::allocator >, bool, bool , bool)' Money.cpp:(.text+0x1a5):CppUnit::TextTestRunner::~TextTestRunner()' Money.cpp:(.text+0x233): undefined reference to
CppUnit::TextTestRunner::~TextTestRunner() への未定義の参照'
私のクラスの間にはリンクがないようです。トラブルは何ですか?