Re: [問題] 有人在 Windows 上 compile 成功嗎?

作者: nick0702 (言)   2012-12-20 16:15:44
※ 引述《trantor (阿精米德)》之銘言:
: 如題,
: 我試過在cygwin上compile但出現undefined reference error。
: 這是我在stackoverfolw上的問題:
: http://stackoverflow.com/questions/13927458/cygwin-g-build-error-undefined-reference-to/13928777#comment19202946_13928777
同學您好:
This assignment is designed for LINUX-SPECIFIC platform.
The codes you turn in should work on LINUX machine.
一開始我也以為 少了buf.h 和hfpage應該不能make
但是在工作站 make之後可以跑
後來我查了一下資料 看了makefile
http://blog.yam.com/ytha/article/16636287
這邊有介紹的滿清楚的
另外鳥哥的
http://linux.vbird.org/linux_basic/0520source_code_and_tarball.php#library_dyna_sta
我想是因為有
libbtree.a
-L. 指目前所在目錄, 如果libtest.a是放在其他目錄下, 請在-L後面加上所在位置,
-lbtree 就是指 libbtree.a
把一些lib 都使用linux 內建的或其他lib
所以讓一些沒有完整的code能夠跑!
如果使用其他系統 libbtree.a應該要重新產生
以下是我mac mini Mac OSX version 10.7.5 直接 make得錯誤
g++ -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
ld: warning: ignoring file ./libbtree.a, file was built for archive which is
not the architecture being linked (x86_64)
Undefined symbols for architecture x86_64:
"BufMgr::pinPage(int, Page*&, int, char const*)", referenced from:
BTreeFile::printPage(int) in btfile.o
BTreeFile::updateHeader(int) in btfile.o
BTreeFile::_insert(void const*, RID, KeyDataEntry**, int*, int)in
btfile.o
BTreeFile::findRunStart(void const*, BTLeafPage**, RID*)in btfile.o
BTreeFile::printLeafPages() in btfile.o
BTreeFile::naiveDelete(void const*, RID)in btfile.o
BTreeFile::_destroyFile(int) in btfile.o
...
很明顯 libbtree.a檔造成 無法compile成功
hw3的時候我也在mac 和 unbuntu (某位同學的)電腦上make
當時也是失敗
我還是推薦你再系上的工作站跑
如果要其他系統 你試試看把之前的code buf.c 和 hfpage.c 都放進去試試看
不過我不確定會不會成功
ps : ptt上的我順便把這篇貼上回文
希望能回答到你的問題
-TA 葉俊言
作者: nick0702 (言)   2012-12-20 16:19:00
應該是hw4測試的不是hw3 打錯了!
作者: trantor   2012-12-20 18:32:00
感謝~

Links booklink

Contact Us: admin [ a t ] ucptt.com