<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>VSCode Includes with custom modules? nCS</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/83647/vscode-includes-with-custom-modules-ncs</link><description>Hi Everyone, I&amp;#39;ve started working with Zephyr, VSCode and nCS. I&amp;#39;m using a sample and working on it modifiying things, but I&amp;#39;m not able to include extern modules, lemme explain it; I&amp;#39;ve developed some modules that will help in my work, but when I add</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 14 Jan 2022 14:21:40 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/83647/vscode-includes-with-custom-modules-ncs" /><item><title>RE: VSCode Includes with custom modules? nCS</title><link>https://devzone.nordicsemi.com/thread/347793?ContentTypeID=1</link><pubDate>Fri, 14 Jan 2022 14:21:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4ff7b7d8-b959-4d4f-8350-69f33b75d23d</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello MatiasP,&lt;/p&gt;
&lt;p&gt;To include custom files in Zephyr you need to add them to your CMakeLists.txt file. You&amp;#39;ll need to do the following:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;For header files, add this to the end of CMakeLists.txt:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;zephyr_library_include_directories(src/my_module)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This will include the path to your include folders. After this, you should be able to include them like normally from your main.c file using:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#include &amp;quot;my_custom_file.h&amp;quot;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;For source files, you need to add this to the end of CMakeLists.txt:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;target_sources(app PRIVATE
    src/my_module/my_custom_file.c
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;If you want to add more files, you can add separate them using &amp;quot;;&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;target_sources(app PRIVATE
    src/my_module/my_custom_file.c;
    src/my_module/my_other_custom_file.c&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I hope that answers your question. If not, please let me know.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: VSCode Includes with custom modules? nCS</title><link>https://devzone.nordicsemi.com/thread/347788?ContentTypeID=1</link><pubDate>Fri, 14 Jan 2022 14:08:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:78772604-0a2c-4cf6-a1ce-70bdcfe10d83</guid><dc:creator>MatiasP</dc:creator><description>&lt;p&gt;Hi Everyone, If someone else is facing this problem, I&amp;#39;ve solved it adding&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="json"&gt;            &amp;quot;browse&amp;quot;: {
                &amp;quot;path&amp;quot;: [
                    &amp;quot;${workspaceFolder}/include&amp;quot;
                ]
            },&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;in the c_cpp_properties.json of the worspace, I was missthinking that I had to put the path in the &amp;quot;IncludePath&amp;quot; but no.&lt;br /&gt;&lt;br /&gt;I put the source files in src with the main.c and the header files in a folder named &amp;quot;include&amp;quot; in the root folder of the workspace.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>