<?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>#define Macro syntax got Error message with nRF52840 SDK v15.2.0</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/42836/define-macro-syntax-got-error-message-with-nrf52840-sdk-v15-2-0</link><description>Hi, I have a defined MACRO which I initialised the values of ble_gap_adv_params_t in main.c. I will pass this to the function to start advertising. I used the example (ble_app_blinky_pca10056_s140) to try out. 
 However , I have two error messages. 
</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 22 Jan 2019 13:04:18 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/42836/define-macro-syntax-got-error-message-with-nrf52840-sdk-v15-2-0" /><item><title>RE: #define Macro syntax got Error message with nRF52840 SDK v15.2.0</title><link>https://devzone.nordicsemi.com/thread/167098?ContentTypeID=1</link><pubDate>Tue, 22 Jan 2019 13:04:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:78f63582-9f73-4615-8cf7-640f2846fe48</guid><dc:creator>awneil</dc:creator><description>[quote userid="76676" url="~/f/nordic-q-a/42836/define-macro-syntax-got-error-message-with-nrf52840-sdk-v15-2-0"]I wonder is my syntax of #define written wrongly [/quote]
&lt;p&gt;remember that the preprocessor just does text substitution - so wherever it sees a macro name, it just replaces that with the text you specified.&lt;/p&gt;
&lt;p&gt;The compiler&amp;nbsp;only sees the result of the text substitution - so its error messages will refer to the &lt;em&gt;substituted&lt;/em&gt; text.&lt;/p&gt;
&lt;p&gt;That&amp;#39;s why looking at the preprocessor output will help you to see what is wrong.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: #define Macro syntax got Error message with nRF52840 SDK v15.2.0</title><link>https://devzone.nordicsemi.com/thread/167085?ContentTypeID=1</link><pubDate>Tue, 22 Jan 2019 12:47:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:00eb5ac0-cb58-46fa-9ae0-4bdc96d5914a</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;You will have to assign the macro initialization to a variable of the correct type, then you can pass a pointer to the struct to the function:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;ble_gap_adv_params_t adv_params = ADV_1M_LEGACY_CONNECTABLE;
advertising_init_common(&amp;amp;m_adv_data, &amp;amp;adv_params);&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: #define Macro syntax got Error message with nRF52840 SDK v15.2.0</title><link>https://devzone.nordicsemi.com/thread/167056?ContentTypeID=1</link><pubDate>Tue, 22 Jan 2019 11:00:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6968e0b0-02d0-4bad-92da-3de41c82e1a0</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;In particular, think about how this line is going to expand:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;m_adv_handle = advertising_init_common(&amp;amp;m_adv_data, ADV_1M_LEGACY_CONNECTABLE );&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Is that going to result in valid &amp;#39;C&amp;#39; syntax ... ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: #define Macro syntax got Error message with nRF52840 SDK v15.2.0</title><link>https://devzone.nordicsemi.com/thread/167055?ContentTypeID=1</link><pubDate>Tue, 22 Jan 2019 10:58:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e4b33851-e86d-4122-a41d-fb28a1672ef4</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;The way to debug preprocessor problems is to look at the preprocessor output.&lt;/p&gt;
&lt;p&gt;You haven&amp;#39;t mentioned what toolchain you&amp;#39;re using, but for GCC the option you require&amp;nbsp; is &lt;strong&gt;--save-temps&lt;/strong&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://gcc.gnu.org/onlinedocs/gcc/Developer-Options.html"&gt;https://gcc.gnu.org/onlinedocs/gcc/Developer-Options.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;See also:&amp;nbsp;&lt;a href="https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html#Preprocessor-Options"&gt;https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html#Preprocessor-Options&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This is standard &amp;#39;C&amp;#39; stuff - not specific to Nordic:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.8052mcu.com/forum/read/29152"&gt;www.8052mcu.com/.../29152&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.avrfreaks.net/comment/2359281#comment-2359281"&gt;www.avrfreaks.net/.../2359281&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>