我试图用 NetBeans cygwin g++ 编译器构建一个项目( rar 文件)。我可以通过在 ubuntu 下make
的src/目录中运行来构建它。但是,在cygwin下,它一直给我undefined reference to...
。
(在编译之前,我已经更改CC = g++
为CC = g++-3
in src/Makefile。)
错误说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':
.....