简体   繁体   English

如何在Emacs中更改构建/调试的工作目录?

[英]How to change the working directory for build/debug in Emacs?

I'm trying to get accustomed to using Emacs for building and debugging, although I'm having some difficulties. 尽管我遇到了一些困难,但是我试图习惯于使用Emacs进行构建和调试。 My biggest problem right now is that I need to be in (eg have a file open in) the root directory to make -k my applications and I need to be in the binaries directory to run gdb MyApp . 我现在最大的问题是我需要进入根目录(例如,打开文件)才能make -k我的应用程序运行,并且需要进入binaries目录才能运行gdb MyApp

Is it futile to try to get Ctrl+Shift+B to make -k -C <my_hard_coded_dir> and some type of ditto with F5 running gdb <MyApp> from my bin directory? 尝试通过Ctrl + Shift + B从我的bin目录中使用make -k -C <my_hard_coded_dir>和某种同类型的F5运行gdb <MyApp>make -k -C <my_hard_coded_dir>吗? Never mind if the shift key is to much of a hassle for Emacs. 没关系,换档键是否会让Emacs感到麻烦。

To specify what Mx make uses for compilation, you specify the compile-command variable. 若要指定Mx make用于编译的内容,请指定compile-command变量。

(setq compile-command "make -c /path/to/makefile")

For your GDB stuff, the variable is gud-gdb-command-name, so 对于您的GDB东西,变量是gud-gdb-command-name,因此

(setq gud-gdb-command-name "gdb --anotate=3 -cd /path/to/exec")

for compiling i use this spippet in my .emacs 为了进行编译,我在我的.emacs中使用了这个spippet

(global-set-key [f2]   'compile)
(global-set-key [f3]   'next-error)
(setq compile-command "u: & cd \\gbceinspielen\\trunk\\src\\compile & make -k ")

the command "gdb" starts the debugger, but i do not know, wether there is an equivalent to compile-command. 命令“ gdb”启动调试器,但我不知道,是否有等效于compile-command的命令。

I'm personaly use EDE to keep compilation settings for concrete projects, and create compile command on the fly. 我个人使用EDE来保留具体项目的编译设置,并即时创建compile命令。 You can see how it works in my cedet config , starting with line 100 您可以在我的cedet配置中看到它的工作原理,从第100行开始

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM