使用 Eclipse CDT 和备用工具链进行编译时出现问题

发布于 2024-12-26 14:19:48 字数 1088 浏览 6 评论 0原文

我正在尝试使用 Eclipse CDT(版本:Indigo Service Release 1 内部版本 ID:20110916-0149)在 RHEL6 64 位 Linux 中构建和调试我的 c/c++ 项目,但遇到问题。我已经完成了我认为使用备用工具链来执行编译所必需的操作,但似乎缺少一些东西,因为 eclipse 说它编译了源代码,但它并没有真正做到这一点。

对于设置,我转到 C/C++ 项目属性 -> C/C++ 构建配置“调试”配置,在“构建器设置”选项卡上,我取消选中“使用默认构建命令”复选框,并将工具链的名称“mk all”输入到“构建命令”字段中。然后我取消选中“自动生成 Makefiles”复选框。接下来,我将“构建目录”字段更改为“”。最后,我转到“行为”选项卡,取消选中“在资源保存上构建(自动构建)”复选框,并将“make build target”更改为“all ${selected_resource_loc}”。

现在,当我转到我的项目,选择需要构建的子目录,然后单击工具栏上的构建按钮时,会发生以下情况:

1)我在进度窗口中看到“构建项目...”简单地说

2)CDT 构建控制台显示以下内容:

**** Build of configuration Debug for project myproj ****

mk all

**** Build Finished ****

上面是我在代码需要重建、不需要重建以及编译出现错误时看到的内容。我可以通过打开 bash 终端并在我想要构建的目录中输入“mk”来验证这一点。当我从终端编译时,我可以看到编译器输出(成功和错误等),但 Eclipse 没有向我显示任何内容。

我一定错过了一些东西,但我不确定是什么。有人知道我做错了什么吗?

--update--

我发现我的问题是什么,结果是我的构建工具是通过 bash 脚本调用的,顶部没有 shebang。

我的下一个问题是构建始终从项目的根目录调用,该项目没有 makefile。我尝试将“${selected_resource_loc}”变量放入“make build target”字段中,但它似乎没有正确的效果,因为我的“mk all”命令似乎是在变量被转换为每次都是空字符串。关于这个附带问题有什么想法吗?

I'm trying to use Eclipse CDT (Version: Indigo Service Release 1 Build id: 20110916-0149) to build and debug my c/c++ project in RHEL6 64 bit Linux, and I'm having issues. I've done what I thought was necessary to use an alternate toolchain to perform the compilation, but something seems to be missing, as eclipse says that it compiled the source, but it didn't really do it.

For the setup I went to C/C++ Project Properties -> C/C++ Build configuring the "Debug" configuration, on the "Builder Settings" tab I unchecked the "Use default build command" checkbox, and entered the name of my toolchain "mk all" into the "Build command" field. I then unchecked the "Generate Makefiles automatically" checkbox. Next I changed the "Build Directory" field to be "". Lastly I went to the "Behavior" tab and unchecked the "Build on resource save (Auto build)" checkbox and changed the "make build target" to be "all ${selected_resource_loc}" .

Now, when I go to my project, and select a subdirectory that needs to be built, and then click on the build button on the toolbar this is what happens:

1) I see the "Build Project..." in the progress window briefly

2) The CDT build console displays this:

**** Build of configuration Debug for project myproj ****

mk all

**** Build Finished ****

The above is what I see when my code needs rebuilt, does not need rebuilt, and when there are errors in the compilation. I can verify this by opening a bash terminal and typing "mk" in the directory I want to build. When I compile from the terminal, I can see the compiler output (success and errors etc..), but eclipse shows me nothing of the sorts.

I must be missing something, but I'm not sure what. Does anyone have any ideas of what I'm doing wrong?

--update--

I found out what part of my issue was, which turned out to be that my build tool was invoked via a bash script without a shebang at the top.

My next issue is that the build is always invoked from the root of the project, which has no makefile. I have tried putting the "${selected_resource_loc}" variable into both the "make build target" field, but it does not seem to have the correct effect as my "mk all" command seems to be invoked with the variable being translated to an empty string every time. Any ideas on this side issue?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

伏妖词 2025-01-02 14:19:48

'亲爱的来自未来的人们:这是我们到目前为止已经弄清楚的......'

我解决了我的问题问题。我曾请一位具有类似设置的朋友尝试一下,他第一次尝试就成功了。然后我得出结论,这要么是我的安装,要么是我的项目。因此,我继续删除项目文件(.project 和 .cproject)并重新创建项目。当我完成之后,它似乎发挥了作用。我一定选择了一个模糊的不兼容的项目选项,导致某些内容无法扩展 ${selected_resource_loc} 变量。诡异的。我希望这对某人有所帮助。

'DEAR PEOPLE FROM THE FUTURE: Here's what we've figured out so far ...'

I sorta solved my issue. I had asked a friend with a similar setup to try this out, and he got it to work on the first try. I then concluded that it was either my install or my project. Thus, I proceeded to delete the project files (.project and .cproject) and recreate the project. After I completed that, it seemed to work like a charm. I must have selected an obscure incompatible project option, that caused something to not expand the ${selected_resource_loc} variable. Weird. I hope this helps someone along the way.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文