如何在 Eclipse 中正确设置 C 语言项目

发布于 2024-11-25 18:25:26 字数 909 浏览 5 评论 0原文

我是一名经验丰富的 Java 开发人员,并且非常熟悉 Eclipse。最近我一直在尝试迁移 Texas Instrumental< /strong>(BLE)IARC语言项目,进入Eclipse,没有使用IAR官方Eclipse插件,我只想使用Eclipse作为我的代码浏览IDE,我一边学习它的工作原理,一边跟进教程,并在将来使用Eclipse 进行开发。

我已经尝试了一天来迁移该项目,但是我缺少一些有关 Eclipse C 语言 支持的东西。

项目“A”中的 .h 文件中定义了一些类型,在项目“A”的其他 .c 文件中引用了这些类型B”,而 Eclipse 虽然可以“转到声明”,但在项目“B”中显示编译错误。

我注意到在同一场景的其他情况下,我不需要指向任何文件夹作为源文件夹,只要这些文件夹位于项目根目录下,它们就会添加到该项目的构建路径中特定项目,并且还导入到项目“B”中,仅引用项目属性中的“A”项目,这是正确的吗?

另外,我注意到在C语言中,两个项目都可以互相引用,而Eclipse不会困扰我,所以我认为这是合法的,因此我认为应该有C语言 em> 我应该遵循的多项目结构模式,在哪里可以找到这么详细的规范?

谢谢,

亚当·泽哈维。

I'm an experienced Java developer, and I'm very familiar with Eclipse. Lately I've been trying to migrate a Texas Instrumental(BLE), IAR C language project, into Eclipse, without using IAR official Eclipse plugin, I just want to use Eclipse as my code browsing IDE, while I learn how things works, and follow up the tutorial, and in the future use Eclipse to develop.

I've been trying for a day now, to migrate the project, but there is something I'm missing something regarding Eclipse C language support.

There are some types defined in an .h file, in project "A", which is referenced in an other .c file in project "B", and Eclipse although it can "go to declaration", it shows a compilation error in project "B".

I've noticed in other cases of the same scenario, that I don't need to point to any of the folders as source folder, as long as the folders are under the project root directory, they are added to the build path of that specific project, and also imported into a project "B" with only referencing the "A" project in the project properties, is this correct?

Also, I've noticed that in the C language both projects could reference each other, without Eclipse troubling me so I assume this is legit, therefore I assume there should be a C language multi-project structural pattern I should follow, where can I find such detailed specification?

Thanks,

Adam Zehavi.

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

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

发布评论

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

评论(3

2024-12-02 18:25:26

尝试 这个(公共源查找路径首选项)

编辑:在我的 Eclipse CDT Helios 中,我喜欢这样:

右键单击项目>属性> C/C++ 通用 >路径和符号。

然后选择我的语言 (GNU C) 并添加包含我要包含的头文件的文件夹。

对于每个配置(运行/调试)或仅针对活动配置,该操作可以一步自动完成。

Try this (Common Source Lookup Path preference)

Edit: in my Eclipse CDT Helios, I do like this:

Right click on project > Properties > C/C++ General > Paths And Symbols.

then choose my language (GNU C) and add the folders with the header files that I want to include.

That operation could be done automatically in one step for every configurations (Run/Debug) or just for the active configuration.

离线来电— 2024-12-02 18:25:26

我终于明白这是不可能完成的...唉,我努力工作才能够在 Eclipse 中编辑我的代码,同时通过 IAR IDE 运行、调试和将程序部署到微处理器。

I've finally understood that this cannot be done... alas I've worked hard to been able to edit my code in Eclipse while running, debugging, and deploying the program to the Microprocessor via IAR IDE.

南城追梦 2024-12-02 18:25:26

转到项目>属性> C/C++ 通用 >路径和符号 然后单击导出设置... 将包含路径和/或符号定义保存到文件中。在您的其他项目中,您可以使用导入设置...

Go to Project > Properties > C/C++ General > Paths and Symbols Then click Export Settings... to save the include paths and/or symbol definitions to a file. In your other project, you can then use Import Settings...

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