Issue
I want to use VS code for developing linux kernel modules. I added the path to my browse path, but unfortunately it's not working. Here's my c_cpp_properties.json:
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${HOME}/Workspaces/kernel-sources/mainline/linux/include",
"${workspaceRoot}"
],
"defines": [],
"intelliSenseMode": "clang-x64",
"browse": {
"path": [
"${HOME}/Workspaces/kernel-sources/mainline/linux/include/",
"${workspaceRoot}"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
}
],
"version": 3
}
I want to include like #include <linux/miscdevice.h>
but the intellisense parser is unable to find that file. I changed the parser engine to "Tag Parser" because the new default parser is unable to recursive include files, as they are in the kernel sources.
Any thoughts how to configure my intellisense?
I use vs code 1.19 for ubuntu 16.04
Solution
Make sure that the kernel-devel
package is installed.
Where you see green squiggles under a header file #include
, click on it.
It should generate a c_cpp_properties.json
file in the .vscode
directory within your project.
Find the "Linux", "IncludePath" section and add the include paths you need.
Mine ended up looking like this:
"name": "Linux",
"includePath": [
"${workspaceFolder}",
"/usr/include",
"/usr/local/include",
"/usr/src/kernels/3.10.0-693.el7.x86_64/include/",
"/usr/lib/gcc/x86_64-redhat-linux/4.8.2/include/",
"/usr/src/kernels/3.10.0-693.el7.x86_64/arch/x86/include/"
Answered By - Daniel Answer Checked By - Mary Flores (WPSolving Volunteer)