BigInt という名前のライブラリを使用してプロジェクトを作成しようとしています。私のファイル構造は次のとおりです。
/Users/wen/Projects/challenge/fibonacci3/fibonacci3.cpp
/Users/wen/Projects/challenge/fibonacci3/Makefile
/Users/wen/Projects/include/bigint/<.cc files and .hh files>
/Users/wen/Projects/include/bigint/Makefile
Fibonacci3 Makefile は現在
LD_FLAGS =
CC_FLAGS =
# Include libraries
include /Users/wen/Projects/include/bigint/Makefile
# Build object files
%.o: %.cc %.cpp $(library-cpp)
g++ -c -o $@ $(CC_FLAGS)
# Link object files
fibonacci3: fibonacci3.o $(library-objects)
g++ -o $@ $(LD_FLAGS)
bigint Makefileは(短縮)のとおりです
# Mention default target.
all:
# Implicit rule to compile C++ files. Modify to your taste.
%.o: %.cc
g++ -c -O2 -Wall -Wextra -pedantic $<
# Components of the library.
library-cpp = \
BigUnsigned.cc \
BigInteger.cc \
BigIntegerAlgorithms.cc \
BigUnsignedInABase.cc \
BigIntegerUtils.cc \
library-objects = \
BigUnsigned.o \
BigInteger.o \
BigIntegerAlgorithms.o \
BigUnsignedInABase.o \
BigIntegerUtils.o \
library-headers = \
NumberlikeArray.hh \
BigUnsigned.hh \
BigInteger.hh \
BigIntegerAlgorithms.hh \
BigUnsignedInABase.hh \
BigIntegerLibrary.hh \
しかし、ヘッダーファイルmake
のルールが見つからなかったと報告していますか?
make: *** No rule to make target `NumberlikeArray.hh', needed by `BigUnsigned.o'. Stop.
[Finished in 0.0s with exit code 2]
ここで何が起きてるの?ヘッダーはコンパイルではなくインクルードされることになっているのに、make がそれを要求するのはなぜですか?
前もって感謝します!
解決:
メイクファイルを含める代わりに、独自のメイクファイルでソースをコンパイルします。出来た!再度、感謝します。