0
プロジェクトのコンパイルに問題があります。私は与えられたメインファイル(main_wb2.cpp)に対して、wordbench2.h、wordbench2.cpp、makefile.wb2、oaa_bst.hというファイルをコーディングしています。誰もが私のメイクファイルに間違った何かを見ているmakefile定義されていない参照エラー
LIB = /home/courses/cop4530p/LIB
CPP = $(LIB)/cpp
TCPP = $(LIB)/tcpp
PROJ = .
INCPATH = -I$(PROJ)-I$(CPP)-I$(TCPP)
CC = g++ -std=c++11 -Wall -Wextra -I. -I$(CPP)
#target:
all: wb2.x foaa.x moaa.x
#foaa+.x
main_wb2.o: wordbench2.h main_wb2.cpp
$(CC) -c main_wb2.cpp
foaa.o: wordbench2.h foaa.cpp
$(CC) -c foaa.cpp
moaa.o: wordbench2.h moaa.cpp
$(CC) -c moaa.cpp
wordbench2.o: wordbench2.h wordbench2.cpp wordify.cpp
$(CC) -c wordbench2.cpp
xstring.o: $(CPP)/xstring.h $(CPP)/xstring.cpp
$(CC) $(INCPATH) -c $(CPP)/xstring.cpp
wb2.x: main_wb2.o wordbench2.o xstring.o
$(CC) -o wb2.x main_wb2.o
foaa.x: foaa.o wordbench2.o xstring.o
$(CC) -o foaa.x foaa.o
moaa.x: moaa.o wordbench2.o xstring.o
$(CC) -o moaa.x moaa.o
このルールでエラー
g++ -std=c++11 -Wall -Wextra -I. -I/home/courses/cop4530p/LIB/cpp -o wb2.x main_wb2.o
main_wb2.o: In function `main':
main_wb2.cpp:(.text+0xfd): undefined reference to `WordBench::WordBench()'
main_wb2.cpp:(.text+0x109): undefined reference to `fsu::String::String()'
main_wb2.cpp:(.text+0x115): undefined reference to `fsu::String::String()'
main_wb2.cpp:(.text+0x1ad): undefined reference to `fsu::operator>>(std::istream&, fsu::String&)'
main_wb2.cpp:(.text+0x1c4): undefined reference to `fsu::operator<<(std::ostream&, fsu::String const&)'
main_wb2.cpp:(.text+0x1f1): undefined reference to `fsu::operator<<(std::ostream&, fsu::String const&)'
main_wb2.cpp:(.text+0x21e): undefined reference to `fsu::operator>>(std::istream&, fsu::String&)'
main_wb2.cpp:(.text+0x235): undefined reference to `fsu::operator<<(std::ostream&, fsu::String const&)'
main_wb2.cpp:(.text+0x25d): undefined reference to `WordBench::ReadText(fsu::String const&, bool)'
main_wb2.cpp:(.text+0x28f): undefined reference to `fsu::operator>>(std::istream&, fsu::String&)'
main_wb2.cpp:(.text+0x2a6): undefined reference to `fsu::operator<<(std::ostream&, fsu::String const&)'
main_wb2.cpp:(.text+0x2d3): undefined reference to `fsu::operator<<(std::ostream&, fsu::String const&)'
main_wb2.cpp:(.text+0x300): undefined reference to `fsu::operator>>(std::istream&, fsu::String&)'
main_wb2.cpp:(.text+0x317): undefined reference to `fsu::operator<<(std::ostream&, fsu::String const&)'
main_wb2.cpp:(.text+0x33f): undefined reference to `WordBench::ReadText(fsu::String const&, bool)'
main_wb2.cpp:(.text+0x371): undefined reference to `fsu::operator>>(std::istream&, fsu::String&)'
main_wb2.cpp:(.text+0x388): undefined reference to `fsu::operator<<(std::ostream&, fsu::String const&)'
main_wb2.cpp:(.text+0x3b5): undefined reference to `fsu::operator<<(std::ostream&, fsu::String const&)'
main_wb2.cpp:(.text+0x3e2): undefined reference to `fsu::operator>>(std::istream&, fsu::String&)'
main_wb2.cpp:(.text+0x3f9): undefined reference to `fsu::operator<<(std::ostream&, fsu::String const&)'
main_wb2.cpp:(.text+0x42f): undefined reference to `WordBench::WriteReport(fsu::String const&, unsigned short, unsigned short, std::_Ios_Fmtflags, std::_Ios_Fmtflags) const'
main_wb2.cpp:(.text+0x44d): undefined reference to `fsu::String::operator=(fsu::String const&)'
main_wb2.cpp:(.text+0x45e): undefined reference to `fsu::String::Size() const'
main_wb2.cpp:(.text+0x488): undefined reference to `fsu::String::Cstr() const'
main_wb2.cpp:(.text+0x4d9): undefined reference to `fsu::operator<<(std::ostream&, fsu::String const&)'
main_wb2.cpp:(.text+0x572): undefined reference to `WordBench::ClearData()'
main_wb2.cpp:(.text+0x595): undefined reference to `WordBench::ShowSummary() const'
main_wb2.cpp:(.text+0x67a): undefined reference to `fsu::String::~String()'
main_wb2.cpp:(.text+0x686): undefined reference to `fsu::String::~String()'
main_wb2.cpp:(.text+0x695): undefined reference to `WordBench::~WordBench()'
main_wb2.cpp:(.text+0x6cb): undefined reference to `fsu::String::~String()'
main_wb2.cpp:(.text+0x6dc): undefined reference to `fsu::String::~String()'
main_wb2.cpp:(.text+0x6f0): undefined reference to `WordBench::~WordBench()'
collect2: error: ld returned 1 exit status
make: *** [wb2.x] Error 1
あなたのコンパイルルールでは、最初の前提条件として '* .cpp'を入れ、レシピに自動変数' $ <'(最初の前提条件)を使用します。 –