2014-09-21 50 views
0

有人可以告訴我如何解決這個問題。我試圖編譯這個庫的位置: http://www.codeproject.com/Articles/42504/ExcelFormat-Library編譯ExcelFormat庫

我做:g++ Examples.cpp

gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)

如果我的問題是容易/基本/簡單/ OS依賴......請告訴推薦我應該先閱讀一本或兩本書,以便能夠找出這個問題的答案。

這裏的錯誤消息:

/tmp/cczceVBy.o:在功能example1(char const*)': Examples.cpp:(.text+0x2d): undefined reference to YExcel :: BasicExcel :: BasicExcel()」 Examples.cpp :(文本+ 0×41):未定義參照YExcel::BasicExcel::New(int)' Examples.cpp:(.text+0x55): undefined reference to YExcel :: BasicExcel :: GetWorksheet(int)' Examples.cpp :(。text + 0x75):undefined reference to ExcelFormat::XLSFormatManager::XLSFormatManager(YExcel::BasicExcel&)' Examples.cpp:(.text+0xf2): undefined reference to YExcel :: BasicExcelWorksheet :: Cell(int,int)' Examples.cpp :(.text + 0x10d) :未定義參照YExcel::BasicExcelCell::Set(char const*)' Examples.cpp:(.text+0x166): undefined reference to YExcel :: BasicExcelWorksheet ::細胞(INT,INT) ' Examples.cpp :(文本+ 0x173):未定義參照YExcel::BasicExcelCell::Set(char const*)' Examples.cpp:(.text+0x287): undefined reference to YExcel :: BasicExcelWorksheet ::細胞(INT,INT)' Examples.cpp :(。text + 0x2a2):未定義的引用YExcel::BasicExcelCell::Set(char const*)' Examples.cpp:(.text+0x2df): undefined reference to YExcel :: BasicExcelWorksheet :: Cell(int,int)'

---- snip許多同類-----

collect2:ld返回1退出狀態

+0

難道你不只是爲了鏈接庫嗎? – user1810087 2014-09-21 11:43:47

+0

您需要在編譯行中添加'-lsomename'。 'somename'應該與庫中包含的'libsomename.lib'匹配。 – 2014-09-21 11:46:07

回答

0

在Excelformat zip文件附帶的項目目錄中使用BasicExcel.Cpp和BasicExcel.hpp文件。