Cedet 帮助:配置“Make”项目
我正在为我的 c/c++ 项目学习 cedet。然而,我在 Make 项目中遇到了困难。
说我有一个文件 main.cpp 看起来像这样
//main.cpp
#include "temp.h"
blah... <c++ code>
,我有 temp.h 和 temp.cpp
看起来像这样
//temp.h
some declarations
//temp.cpp
some definitions
然后在 emacs+cedet 中,我执行 ede-new
然后添加一个目标 main< /strong> 使用 ede-new-target
并将 main.cpp 添加到 main.cpp 中。
然后我编写 temp.h 和 temp.cpp 并将 temp.cpp 添加到目标温度。
我选择所有目标作为生成此 Project.ede 文件的程序
;; Object Test
;; EDE project file.
(ede-proj-project "Test"
:name "Test"
:file "Project.ede"
:targets (list
(ede-proj-target-makefile-program "main"
:name "main"
:path ""
:source '("main.cpp")
)
(ede-proj-target-makefile-program "temp"
:name "temp"
:path ""
:source '("temp.cpp")
)
)
)
现在,当我使用 ede-proj-regenerate 生成 makefile 时,它会创建一个生成 main.o 和 temp.o 的 Makefile,
但是 make 失败,如下所示生成的 Makefile 无法识别 main.cpp 对 temp.cpp 的依赖关系。我如何告诉 cedet EDE 识别这种依赖关系?我在这里做的事情有什么问题吗?
其次,我如何告诉它我不想要 main.o,因为这是最终的目标程序/可执行文件而不是目标文件。
I am learning cedet for my c/c++ projects. However, I am facing difficulty in Make projects.
Say I have a file
main.cpp that looks like this
//main.cpp
#include "temp.h"
blah... <c++ code>
and I have temp.h and temp.cpp
that look like this
//temp.h
some declarations
//temp.cpp
some definitions
Then in emacs+cedet, I do ede-new
and then I add a target main using ede-new-target
and add main.cpp to main.
Then I write temp.h and temp.cpp and add temp.cpp to target temp.
I choose all targets as program generating this Project.ede file
;; Object Test
;; EDE project file.
(ede-proj-project "Test"
:name "Test"
:file "Project.ede"
:targets (list
(ede-proj-target-makefile-program "main"
:name "main"
:path ""
:source '("main.cpp")
)
(ede-proj-target-makefile-program "temp"
:name "temp"
:path ""
:source '("temp.cpp")
)
)
)
Now when I generate the makefile using ede-proj-regenerate, it creates a Makefile that generates main.o and temp.o
The make however fails as the Makefile generated does not identify the dependency of main.cpp on temp.cpp. How can I tell cedet EDE to identify this dependency? What is wrong in what I am doing here?
And secondly, how do I tell it that I do not want main.o as this is the final target program/executable and not an object file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于您的示例,创建的
Makefile
应该同时创建main.o
和main
。您创建的目标的名称应该是您的程序的名称,因此如果您将名为“main”的目标更改为“Pickle”,它将创建一个 main.o 和一个 Pickle 程序。编辑 temp.cpp 时,应将其添加到 main 或 Pickle(如果您选择重命名目标)。将程序的所有源文件放入单个目标中,除非您选择创建库,在这种情况下,请将 temp 添加到库类型目标中。
要“修复问题”,您可以使用
customize-project
命令访问通常无法通过 Emacs 本身的简单命令获得的所有其他选项。这将允许您添加对库的依赖项、将标头添加为 aux src 以及其他有用的内容。只需阅读与不同选项相关的文档字符串即可。EDE 快速入门可以此处找到 。
For your example, the created
Makefile
should be creating bothmain.o
, andmain
. The name of the target you create should be the name of your program, so if you changed the target named "main" to "Pickle", it will create a main.o, and a Pickle program.When you edit temp.cpp, you should add it to main, or Pickle if you choose to rename the target. Put all your source files for the program into the single target, unless you are choosing to create a library, in which case add temp to a library type target instead.
To "Fix things up", you can use the
customize-project
command to access all the other options not usually available via simple commands from Emacs proper. That will let you add dependencies on libraries, add your headers as aux src, and other useful things. Just read the doc strings associated with the different options.A quick start for EDE can be found here.