NetBeans cygwin g++ コンパイラを使用してプロジェクト ( rar ファイル) をビルドしようとしていました。ubuntumake
のsrc/ディレクトリで実行することでビルドできました。しかし、cygwin では、それは私に与え続けましたundefined reference to...
。
(コンパイルする前に、私はsrc/MakefileCC = g++
に変更しCC = g++-3
ました。)
エラーはundefined reference to BufMgr::pinPage(int, Page*&, int, char const*)
、 wherepinPage()
がinclude/にあると述べました。
これがプロジェクトの構造です。
project/
include/
buf.h (where pinPage() was defined)
other header files
src/
Makefile
other source files
以下は元の Makefile とエラーです。
メイクファイル:
#
# Makefile for CS564 Minibase project. Needs GNU make.
#
# Define DEBUGREL for some kind of debugging output (not from us, from
# the original Minibase implementors.)
#
# Warning: make depend overwrites this file.
.PHONY: depend clean backup setup
MAIN = btree
MINIBASE = ..
CC = g++
#CFLAGS = -DUNIX -Wall -g
CFLAGS = -g
INCLUDES = -I${MINIBASE}/include -I.
LFLAGS = -L. -lbtree -lm
SRCS = main.C btree_driver.C btfile.C btindex_page.C btleaf_page.C btree_file_scan.C key.C db.C new_error.C sorted_page.C system_defs.C
OBJS = $(SRCS:.C=.o)
$(MAIN): $(OBJS)
$(CC) $(CFLAGS) $(INCLUDES) $(OBJS) -o $(MAIN) $(LFLAGS)
.C.o:
$(CC) $(CFLAGS) $(INCLUDES) -c $<
depend: $(SRCS)
makedepend $(INCLUDES) $^
clean:
rm -f *.o *~ $(MAIN)
rm -f my_output
backup:
-mkdir bak
cp Makefile *.[Ch] bak
run:
rm -rf my_output
./btree > my_output
# Grab the sources for a user who has only the makefile
setup:
/bin/cp -i $(MINIBASE)/src/*.[Ch] .
/bin/cp -i $(MINIBASE)/src/*.sample .
# DO NOT DELETE THIS LINE -- make depend needs it
エラー:
$ make
g++-3 -g -I../include -I. -c main.C
g++-3 -g -I../include -I. -c btree_driver.C
g++-3 -g -I../include -I. -c btfile.C
g++-3 -g -I../include -I. -c btindex_page.C
g++-3 -g -I../include -I. -c btleaf_page.C
g++-3 -g -I../include -I. -c btree_file_scan.C
g++-3 -g -I../include -I. -c key.C
g++-3 -g -I../include -I. -c db.C
g++-3 -g -I../include -I. -c new_error.C
g++-3 -g -I../include -I. -c sorted_page.C
g++-3 -g -I../include -I. -c system_defs.C
g++-3 -g -I../include -I. main.o btree_driver.o btfile.o btindex_page.o btleaf_page.o btree_file_scan.o key.o db.o new_error.o sorted_page.o system_defs.o -o btree -L. -lbtree -lm
btfile.o: In function `_ZN9BTreeFileC2ER6StatusPKc':
/cygdrive/c/Users/Trantor/Documents/NetBeansProjects/DB-HW6/src/btfile.C:78: undefined reference to `BufMgr::pinPage(int, Page*&, int, char const*)'
btfile.o: In function `_ZN9BTreeFileC1ER6StatusPKc':
/cygdrive/c/Users/Trantor/Documents/NetBeansProjects/DB-HW6/src/btfile.C:78: undefined reference to `BufMgr::pinPage(int, Page*&, int, char const*)'
btfile.o: In function `_ZN9BTreeFileC2ER6StatusPKc8AttrTypeii':
.....