为 Linux 内核模块开发配置 Eclipse
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22168095/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Configuring Eclipse for Linux Kernel module development
提问by SP5RFD
I'm trying to configure Eclipse for developing Linux Kernel Modules under Ubuntu. So far I've added to Properties
> Paths and Symbols
> Includes
> GNU C
headers from directory /usr/src/'uname -r'/include
but it doesn't remove all the Syntax error
from my code.
我正在尝试配置 Eclipse 以在 Ubuntu 下开发 Linux 内核模块。到目前为止,我已经从目录中添加到Properties
> Paths and Symbols
> Includes
>GNU C
标头,/usr/src/'uname -r'/include
但它并没有Syntax error
从我的代码中删除所有的。
After that, my code looks like this:
之后,我的代码如下所示:
What else should I do to develop Kernel modules with pleasure?
我还应该做什么才能愉快地开发内核模块?
采纳答案by pjenney58
If you're interested, those orange squigglies are actually indexer markers. Turn them off by going to window/preferences/general/editors/text editors/annotations, select c/c++indexer markers and uncheck 'text as'.
如果您感兴趣,那些橙色波浪线实际上是索引器标记。通过转到 window/preferences/general/editors/text editors/annotations 关闭它们,选择 c/c++indexer 标记并取消选中“text as”。
Also, this was posted on the Eclipse wiki: http://wiki.eclipse.org/HowTo_use_the_CDT_to_navigate_Linux_kernel_source
此外,这已发布在 Eclipse wiki 上:http: //wiki.eclipse.org/HowTo_use_the_CDT_to_navigate_Linux_kernel_source
回答by benf
If you are building an Out-of-Tree kernel module, follow the steps in the CDT wiki (linked in @pjenney58's response).
如果您正在构建 Out-of-Tree 内核模块,请按照 CDT wiki 中的步骤操作(链接在 @pjenney58 的响应中)。
The key difference is at Step 30 (Source Location->expand your project name).
主要区别在于第 30 步(源位置-> 扩展您的项目名称)。
- Instead of adding a filter to your own source folder, choose "Link Folder..." to add the kernel source.
- Check 'Link to folder in the file system' and select the path to your kernel source.
- Click Ok, then follow the instructions for adding the filter (steps 31 & 32 in the wiki) but do it on the kernel source instead of your module folder.
- 不要向您自己的源文件夹添加过滤器,而是选择“链接文件夹...”来添加内核源。
- 选中“链接到文件系统中的文件夹”并选择内核源的路径。
- 单击“确定”,然后按照添加过滤器的说明(wiki 中的步骤 31 和 32)进行操作,但要在内核源代码而不是模块文件夹中进行。
In my project that took care of almost all the indexer markers complaining about syntax errors.
在我的项目中,几乎所有的索引器标记都抱怨语法错误。