<?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>How to add a custom header and c file into a project.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/76075/how-to-add-a-custom-header-and-c-file-into-a-project</link><description>Hi, 
 I have a ncs project which currently has only the main.c file. 
 I want to create a header file and the c file to be included in the main. 
 What&amp;#39;s the recommended way to do this. 
 I tried creating them manually in the src folder - failed. 
 I</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 08 Jun 2021 10:06:48 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/76075/how-to-add-a-custom-header-and-c-file-into-a-project" /><item><title>RE: How to add a custom header and c file into a project.</title><link>https://devzone.nordicsemi.com/thread/314163?ContentTypeID=1</link><pubDate>Tue, 08 Jun 2021 10:06:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4e4c8cc8-7a94-492c-9f9f-190e19754fbc</guid><dc:creator>_RK_</dc:creator><description>&lt;p&gt;Hi Elfving,&lt;/p&gt;
&lt;p&gt;Thanks for your response. WIth the hlep of&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;target_sources&lt;/strong&gt; as you mentioned and&amp;nbsp;&lt;strong&gt;target_include_directories&lt;/strong&gt; for inclusions of the .h files i was able to include them in the build.&lt;/p&gt;
&lt;p&gt;Cheers.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to add a custom header and c file into a project.</title><link>https://devzone.nordicsemi.com/thread/313957?ContentTypeID=1</link><pubDate>Mon, 07 Jun 2021 13:52:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a5d8aaf-185e-40b5-a727-e838e95b1fd9</guid><dc:creator>Elfving</dc:creator><description>&lt;p&gt;Hello!&lt;/p&gt;
&lt;p&gt;For one you need to include the c-file in your CMakeLists.txt file, by adding: &amp;quot;target_sources(app PRIVATE src/[filename])&amp;quot;, and then re-run CMake by either using the &amp;#39;Project&amp;#39; drop-down menu, or reopening the project. Then&amp;nbsp;the files should be visible in SES, and be a part of your project.&lt;/p&gt;
&lt;p&gt;I recommend taking a look at &lt;a href="https://devzone.nordicsemi.com/nordic/nrf-connect-sdk-guides/b/getting-started/posts/nrf-connect-sdk-tutorial---part-1-ncs-v1-4-0"&gt;this tutorial&lt;/a&gt;&amp;nbsp;that explains all of this in further detail. Part 2 may be particularly interesting.&lt;/p&gt;
&lt;p&gt;Let me know if this didn&amp;#39;t help, or if there is anything else!&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>