<?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 do you &amp;quot;turn on&amp;quot; a file with a &amp;quot;_H&amp;quot; compiler directive?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/39172/how-do-you-turn-on-a-file-with-a-_h-compiler-directive</link><description>There aer a couple of ifles in the SDK that use this weird _H compiler directive that prevents them from compiling - how do you control those? For example, NRF_SORTLIST_H, or CRC32_H? seems to be related to the NRF_MODULE_ENABLED() macro.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 10 Oct 2018 07:29:34 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/39172/how-do-you-turn-on-a-file-with-a-_h-compiler-directive" /><item><title>RE: How do you "turn on" a file with a "_H" compiler directive?</title><link>https://devzone.nordicsemi.com/thread/152294?ContentTypeID=1</link><pubDate>Wed, 10 Oct 2018 07:29:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a2064187-ec5e-46c3-b495-f72d21249723</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;The examples in the SDK all have their own sdk_config.h who the compiler have included in their search path, I suggest you use them as a template for your development.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do you "turn on" a file with a "_H" compiler directive?</title><link>https://devzone.nordicsemi.com/thread/152281?ContentTypeID=1</link><pubDate>Wed, 10 Oct 2018 00:02:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:926c81c7-a1f5-453c-93ec-a6d80e4b7b0b</guid><dc:creator>apdobaj</dc:creator><description>&lt;p&gt;It turns out the compiler was not using the correct version of sdk_config.h. Aside from adding the correct sdk_config.h file to the includes of the offending source file, how does one force the usage of one particular sdk_config.h?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do you "turn on" a file with a "_H" compiler directive?</title><link>https://devzone.nordicsemi.com/thread/152019?ContentTypeID=1</link><pubDate>Mon, 08 Oct 2018 11:17:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3b221782-b4c1-4abe-a881-64c72fae949d</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;What example are you based off, and what do I need to add in order to reproduce your issue?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do you "turn on" a file with a "_H" compiler directive?</title><link>https://devzone.nordicsemi.com/thread/151847?ContentTypeID=1</link><pubDate>Fri, 05 Oct 2018 13:16:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f57af813-a8e0-4687-8ba8-bd34578813df</guid><dc:creator>apdobaj</dc:creator><description>&lt;p&gt;By that you mean set CRC32_ENABLED and NRF_SORTLIST_ENABLED to 1 - yes, of course.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do you "turn on" a file with a "_H" compiler directive?</title><link>https://devzone.nordicsemi.com/thread/151758?ContentTypeID=1</link><pubDate>Fri, 05 Oct 2018 06:59:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a1679d72-e5b1-42de-81ba-5b4f1241843f</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;Have you enabled them in sdk_config.h?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do you "turn on" a file with a "_H" compiler directive?</title><link>https://devzone.nordicsemi.com/thread/151690?ContentTypeID=1</link><pubDate>Thu, 04 Oct 2018 13:40:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:552081a0-1e5f-4431-b0a4-73c5ffd6ec69</guid><dc:creator>apdobaj</dc:creator><description>&lt;p&gt;OK, I&amp;#39;m clearly barking up the wrong tree. How do you get crc32_compute(...) to compile? In other words, how do you get NRF_MODULE_ENABLED(CRC32) to resolve true? Or NRF_MODULE_ENABLED(NRF_SORTLIST)?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do you "turn on" a file with a "_H" compiler directive?</title><link>https://devzone.nordicsemi.com/thread/151584?ContentTypeID=1</link><pubDate>Thu, 04 Oct 2018 07:43:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:65b6de7c-dd2b-4219-acde-3b5ba03389cb</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Are you referring to &lt;a href="https://en.wikipedia.org/wiki/Include_guard"&gt;the include guards&lt;/a&gt;? We use include guards like these in pretty much every header file in the SDK. E.g. like this in nrf_sortlist.h:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#ifndef NRF_SORTLIST_H
#define NRF_SORTLIST_H

....

#endif //NRF_SORTLIST_H&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do you "turn on" a file with a "_H" compiler directive?</title><link>https://devzone.nordicsemi.com/thread/151583?ContentTypeID=1</link><pubDate>Thu, 04 Oct 2018 07:43:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a51b3c1d-7130-445b-b989-4f0dfd75973c</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;These are header guards, they prevent the compiler from compiling a header file more than once. F.ex. if two source files both includes the same header file the header guard prevents multiple declarations and definitions of functions, variables, constants, structs, etc.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;There&amp;#39;s nothing you need to do except enable the libraries and drivers you need in sdk_config.h.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>