歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Ubuntu 10.10 安裝黑客背單詞Reciteword

Ubuntu 10.10 安裝黑客背單詞Reciteword

日期:2017/2/28 16:28:27   编辑:Linux教程

Reciteword是一款中文界面的背單詞軟件(也稱黑客背單詞),功能比較強大。在Ubuntu中安裝可能會遇到一些小困難,故在此說明一下。

本文介紹的是從源碼編譯安裝的過程。

Table of Contents
1 下載及安裝(轉載部分)
1.1 下載程序
1.2 准備工具
1.3 黑客背單詞的安裝
2 遇到的編譯錯誤
3 問題解決
1 下載及安裝(轉載部分)
1.1 下載程序

reciteword的網站是: http://reciteword.cosoft.org.cn/reciteword/index.html

作者提供了如下幾個包,請按需下載源碼包:

主程序源碼(必須) reciteword

  • 課本(重要) reciteword-books
  • 詞典(可選) reciteword-dicts
  • 皮膚(可選) reciteword-skins-rw
  • 真人發音 WyabdcRealPeopleTTS (可選,是stardict的真人語音)

1.2 准備工具

先安裝編譯需要的包

apt-get install libesd0-dev pkg-config libgtk2.0-dev esound

如果是Ubuntu 8.04版本,安裝時可能會出現刪除pulseaudio-esound-compat,ubuntu-desktop這兩個文件,請之後再安裝回去,如果不安裝,進入桌面後桌面不成正常使用,我的方法是重啟後按ctrl+alt+f1,進入控制台,打入以下命令:

sudo apt-get install ubuntu-desktop就會安裝這兩個文件,www.linuxidc.com重啟後正常 安裝libesd0-alsa0,保證開啟esd後,仍能用alsa。

apt-get install libesd-alsa0啟用esd,這是reciteword播放聲音所必須的:(假設是gnome環境)

在菜單中:系統->首選項->音效,在打開的窗口中:音效->允許軟件混音(ESD)。

為了使設置生效,建議你最好重新啟動系統。

1.3 黑客背單詞的安裝

安裝過程就沒有什麼特別的了,進入存有reciteword的文件後:

tar -xvfj reciteword-*.tar.bz2

cd reciteword-0.*

./configure –prefix=/usr

make

sudo make install

2 遇到的編譯錯誤

ubuntu會出現這樣編譯出錯

bookfile.cpp: In function ‘gchar* rw_book_get_value(const gchar*, gchar*, gint)’:
bookfile.cpp:95: error: invalid conversion from ‘const char*’ to ‘gchar*’
bookfile.cpp: In function ‘gint rw_book_get_file_info(gchar*, gchar**, gchar**, gchar**, gchar**, gchar**, gchar**)’:
bookfile.cpp:140: warning: deprecated conversion from string constant to ‘gchar*’
bookfile.cpp:153: warning: deprecated conversion from string constant to ‘gchar*’
bookfile.cpp:154: warning: deprecated conversion from string constant to ‘gchar*’
bookfile.cpp:155: warning: deprecated conversion from string constant to ‘gchar*’
bookfile.cpp:156: warning: deprecated conversion from string constant to ‘gchar*’
bookfile.cpp:157: warning: deprecated conversion from string constant to ‘gchar*’
bookfile.cpp: In function ‘BookFile* rw_book_open_file(gchar*)’:
bookfile.cpp:228: warning: deprecated conversion from string constant to ‘gchar*’
bookfile.cpp:229: warning: deprecated conversion from string constant to ‘gchar*’
bookfile.cpp:230: warning: deprecated conversion from string constant to ‘gchar*’
bookfile.cpp:231: warning: deprecated conversion from string constant to ‘gchar*’
bookfile.cpp:232: warning: deprecated conversion from string constant to ‘gchar*’
bookfile.cpp:233: warning: deprecated conversion from string constant to ‘gchar*’
bookfile.cpp:209: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result
make[3]: *** [bookfile.o] 錯誤 1
make[3]:正在離開目錄 `/tmp/word/reciteword-0.8.4/src'
make[2]: *** [all-recursive] 錯誤 1
make[2]:正在離開目錄 `/tmp/word/reciteword-0.8.4/src'
make[1]: *** [all-recursive] 錯誤 1
make[1]:正在離開目錄 `/tmp/word/reciteword-0.8.4'
make: *** [all] 錯誤 2

3 問題解決

bookfile.cpp:95: error: invalid conversion from ‘const char*’ to ‘gchar*

根據以上錯誤找到 bookfile.cpp 在頭文件處加上兩句代碼

#include "bookfile.h"
#include <cstring>
#include <cstdio>
#include <sys/stat.h>
#include <fstream>
#include <string>

const gchar* str1;
const gchar* str2 = strchr(str1, 'a');
再找到函數 (大概在90行裡)
static gchar *
rw_book_get_value (const gchar * str1, gchar * str2,gint utf8)
-----------------------------------------------------
把原來的 tmp1 = strstr (str1, str2);
改為 tmp1 = (gchar*)strstr (str1, str2);

經過上面的改動 再編譯即可

相同問題請參考 http://gcc.gnu.org/gcc-4.4/porting_to.html

訪問: http://ljp.9t9t.info

Author: Li Junpeng <[email protected]>

Date: 2010-10-30 23:34:45 CST

HTML generated by org-mode 6.21b in emacs 23

Copyright © Linux教程網 All Rights Reserved