安装必备的开发包:
sudo apt-get install build-essential
开发环境之emacs
基本C++配置
装了emacs,问TI要了个配置:
(global-set-key [(meta left)] 'backward-sexp)
(global-set-key [(meta right)] 'forward-sexp)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(ecb-options-version "2.32")
'(ecb-primary-secondary-mouse-buttons (quote mouse-1--mouse-2))
'(ecb-source-path (quote ("/usr/include/gtkmm-2.4" "/media/hda10/SourceCode/gftp/GFTP_2_0_17/src" "/media/hda10/SourceCode/gftp/GFTP_2_0_17/lib" "~/programs" ("~/programs/socket/src" "tssocket") ("/home/tigersoldier/programs/tsftp" "tsftp") ("/media/hda9/课程作业" "homework"))))
'(ecb-tip-of-the-day nil)
'(ecb-tree-expand-symbol-before t)
;;设置用空格缩进而不是Tab
'(indent-tabs-mode nil)
'(semanticdb-project-roots (quote ("/" "~/programs/tsftp/")))
'(transient-mark-mode t))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
;支持emacs和外部程序的粘贴
(setq x-select-enable-clipboard t)
;;;使用EDE
(require 'ede)
(global-ede-mode t)
;;;;以下是我的快捷键设置
;;;F3:切换到dired模式
(global-set-key [(f3)] 'dired)
;;;F4:切换到shell模式
(global-set-key [(f4)] 'ansi-term)
;;;F5:打开speedbar
(global-set-key [(f5)] 'speedbar)
;;;F11:打开ecb
(global-set-key [(f11)] 'ecb-activate)
;;;F12:关闭ecb
(global-set-key [(f12)] 'ecb-deactivate)
;;;M-g 转到指定行号
(global-set-key [(meta g)] 'goto-line)
;;;设置选择起点
(global-set-key (kbd "C-x <SPC>") 'set-mark-command)
;;;高亮选择
(transient-mark-mode t)
;;;显示行号
(setq line-number-mode t)
;;;显示列号
(setq column-number-mode t)
;;打开括号匹配显示模式
(setq show-paren-mode t)
;;括号匹配时可以高亮显示另外一边的括号,但光标不会烦人的跳到另一个括号处。
(setq show-paren-style 'parenthesis)
;; "C-,"设为屏幕左移命令
(global-set-key (kbd "C-,") 'scroll-left)
;; "C-."设为屏幕右移命令
(global-set-key (kbd "C-.") 'scroll-right)
;;;; CC-mode配置 http://cc-mode.sourceforge.net/
(require 'cc-mode)
(c-set-offset 'inline-open 0)
(c-set-offset 'friend '-)
(c-set-offset 'substatement-open 0)
;;;;我的C/C++语言编辑策略
;;sematic的检索范围
(setq semanticdb-project-roots
(list
(expand-file-name "/")))
;;自动补齐命令
(defun my-indent-or-complete ()
(interactive)
(if (looking-at "\>")
(hippie-expand nil)
(indent-for-tab-command))
)
(global-set-key [(control tab)] 'my-indent-or-complete)
;;hippie的自动补齐策略
(autoload 'senator-try-expand-semantic "senator")
(setq hippie-expand-try-functions-list
'(
senator-try-expand-semantic
try-expand-dabbrev
try-expand-dabbrev-visible
try-expand-dabbrev-all-buffers
try-expand-dabbrev-from-kill
try-expand-list
try-expand-list-all-buffers
try-expand-line
try-expand-line-all-buffers
try-complete-file-name-partially
try-complete-file-name
try-expand-whole-kill
)
)
;-------------------------------------------------------------------------------
;;doxymacs
;;添加doxymacs所在的路径
(add-to-list 'load-path
"~/share/emacs/site-lisp/")
;;装载doxymacs
(require 'doxymacs)
;;注释高亮,针对C和C++程序
(defun my-doxymacs-font-lock-hook ()
(if (or (eq major-mode 'c-mode) (eq major-mode 'c++-mode))
(doxymacs-font-lock)))
(add-hook 'font-lock-mode-hook 'my-doxymacs-font-lock-hook)
;---------------------------------------------------------------------------------
(defun my-c-mode-common-hook()
(setq tab-width 4 indent-tabs-mode t)
;;; hungry-delete and auto-newline
;(c-toggle-hungry-state 1)
;(c-toggle-auto-newline 0)
;(c-toggle-electric-state 0)
;;按键定义
(define-key c-mode-base-map [(control \`)] 'hs-toggle-hiding)
(define-key c-mode-base-map [(return)] 'newline-and-indent)
(define-key c-mode-base-map [(f7)] 'compile)
;(define-key c-mode-base-map [(meta \`)] 'c-indent-command)
(define-key c-mode-base-map [(tab)] 'my-indent-or-complete)
(define-key c-mode-base-map [(meta ?/)] 'semantic-ia-complete-symbol-menu)
;;预处理设置
(setq c-macro-shrink-window-flag t)
(setq c-macro-preprocessor "cpp")
(setq c-macro-cppflags " ")
(setq c-macro-prompt-flag t)
(setq hs-minor-mode t)
(setq abbrev-mode t)
;;doxymacs
(doxymacs-mode)
)
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
;;;;我的C++语言编辑策略
(defun my-c++-mode-hook()
(setq tab-width 4 indent-tabs-mode t)
(c-set-style "stroustrup")
;; (define-key c++-mode-map [f3] 'replace-regexp)
)
(put 'scroll-left 'disabled nil)
;;jflex-mode
(autoload 'jflex-mode "jflex-mode" nil t)
(setq auto-mode-alist (cons '("\\(\\.flex\\|\\.jflex\\)\\'" . jflex-mode) auto-mode-alist))
保存到主目录下的.emacs文件中即可
安装ecb
ecb是用来浏览代码用的,也就是列出代码中的函数啊什么的,写大规模的程序的时候必用的。 ecb的安装似乎比较麻烦,幸好ubuntu已经帮我们准备好了:
sudo apt-get install ecb
安装完后在Emacs中按M-x(Alt+X),输入ecb-activate就可以启动ecb了
第一次运行ecb时,要配置一下它所使用的文件夹
M-x customize-option
ecb-source-path
接下来就是图形化界面的配置了,把常用的代码目录都加进去吧,单击Finish可以关闭,关闭前别忘了保存。
配置完后可能鼠标单击没反应,可修改ecb-primary-secondary-mouse-buttons选项:
M-x customize-option
ecb-primary-secondary-mouse-buttons
选第三个(Primary: mouse-1, secondary: mouse-2)即可
关于开发用的详细配置,可参考
[转]在Emacs下用C、C++编程
另外据说还有cscope和doxymacs也很有用,以后再试
安装eclipse
首先确保安装了java运行库,为了开发方便我连同jdk一起装了
sudo apt-get install sun-java6-jdk
不想用jdk的只装jre就行(装jdk会自动装jre)
sudo apt-get install sun-java6-jre
之后就可以安装eclipse了
sudo apt-get install eclipse
顺便装语言包
sudo apt-get install eclipse-nls
安装GTK开发环境
另外打算玩玩gtk和gnome编程,要把编译用的开发包装上:
sudo apt-get install libgtk1.2-dev gnome-devel libgnome-dev
注意编译时的编译参数,编译gtk程序要用
`gtk-config --cflags --libs`
编译gnome的则是
`gnome-config --cflags --libs gnomeui`
doxygen
doxygen是用于生成C++文档的工具
sudo apt-get install doxygen-gui doxygen-doc
svn
安装
sudo apt-get install subversion
sudo apt-get install libapache2-svn
创建开发库,以我的编译原理实验为例
sudo mkdir -p /home/svn/compiler
sudo svnadmin create /home/svn/compiler/
导入项目目录,项目目录里必须有branches、tags和trunk三个目录,其中trunk目录里放代码,其他两个留空就行。
由于我之前做的实验代码没有这种结构,我又不想改变我已有的目录结构,因此我在/tmp/mycompiler里建立一个虚拟项目,并把原来的代码目录mount到这里的trunk下:
mkdir /tmp/mycompiler
cd /tmp/mycompiler/
mkdir branches
mkdir tags
mkdir trunk
sudo mount --bind /home/tigersoldier/mnt/homework/compiler/实验/ /tmp/mycompiler/trunk/
现在可以导入它了:
sudo svn import /tmp/mycompiler/ file:///home/svn/compiler -m "initial import"
添加网络服务:
如果没有安装xinetd,先安装之
sudo apt-get install xinetd
编辑服务文件/etc/services(Ubuntu无需这一步)
在文件中添加svn服务:
svn 3690/tcp subversion # Subversion protocol
svn 3690/udp subversion
为xinetd添加svn的配置:
sudo gedit /etc/xinetd.d/svn
内容如下:
service svn
{
type = INTERNAL
server = svnserve
id = svn_stream
socket_type = stream
protocol = tcp
user = root
wait = no
server_args = -i -r /home/svn/
}
重新启动xinetd服务
sudo /etc/init.d/xinetd restart
为eclipse添加SVN支持:
到http://subclipse.tigris.org/下载Subclipse,或者在Eclipse里设置插件更新地址:http://subclipse.tigris.org/update_1.2.x
不断添加中……
Mar 28, 2010 12:58:50 AM
好吧...为了纪念那个纠结的jflex-mode..我在这里留个脚印...
Jan 23, 2023 02:34:40 PM
Jaa Lifestyle is a money-earning website that has its roots in the United Kingdom. The Jaa Lifestyle is not fully open in India, but still, an individual can try to get a glance at services from the website. Jaa Login They offer some new ways to earn money by involving individuals in different activities. There are referral programs and other games in Java Lifestyle, which are available to earn money. An individual has to fully get involved in the activities and has to win the game to earn money.