<?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>Build example project using C++11 with SEGGER_IDE failed</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/47043/build-example-project-using-c-11-with-segger_ide-failed</link><description>Hi, in these days I want use the new feature of C++11 in nrf52 project, so I rename the &amp;quot;main.c&amp;quot; file to &amp;quot;main.cpp&amp;quot;(ble_app_blinky project), select the C++11 compiler in project options dialog, 
 
 then start building, it failed and the infomation is</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 10 May 2019 05:50:01 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/47043/build-example-project-using-c-11-with-segger_ide-failed" /><item><title>RE: Build example project using C++11 with SEGGER_IDE failed</title><link>https://devzone.nordicsemi.com/thread/186283?ContentTypeID=1</link><pubDate>Fri, 10 May 2019 05:50:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e93eae73-38fb-4005-89a0-f6999544775e</guid><dc:creator>mjt110</dc:creator><description>&lt;p&gt;Only renamed &amp;quot;main.c&amp;quot;。I checked the code in &amp;rdquo;nrf_pwr_mgmt.h&amp;ldquo; (&lt;span&gt;&amp;nbsp;&amp;rdquo;nrf_pwr_mgmt_init&amp;ldquo; and &amp;rdquo;nrf_pwr_mgmt_run&amp;ldquo; defined in this header), and I found that there&amp;#39;s no &amp;quot;ifdef _cplusplus_ extern &amp;quot;C&amp;quot;&amp;quot; preprocessor at the begining of the head file, after I append these code to this file, the entire project can be built seccessfully.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/TIM_2A62FE56_20190510134817.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/TIM_2A62FE56_20190510134908.png" /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Build example project using C++11 with SEGGER_IDE failed</title><link>https://devzone.nordicsemi.com/thread/186100?ContentTypeID=1</link><pubDate>Thu, 09 May 2019 08:20:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:53a18f03-6cbb-4519-b822-1b544e045a02</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;You said you&amp;#39;ve renamed &amp;quot;main.c&amp;quot; to &amp;quot;main.cpp&amp;quot; - but have you also renamed all the other &lt;strong&gt;*.c&lt;/strong&gt; source files to *&lt;strong&gt;.cpp?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Without that, they will still be built as &amp;#39;C&amp;#39; - not C++ - and, therefore, linker errors are to be expected ...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Build example project using C++11 with SEGGER_IDE failed</title><link>https://devzone.nordicsemi.com/thread/186062?ContentTypeID=1</link><pubDate>Thu, 09 May 2019 06:18:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f273953-9179-4180-9a6e-f43904714d86</guid><dc:creator>mjt110</dc:creator><description>&lt;p&gt;Thanks for reply! I modify the code like&amp;nbsp;&lt;a class="internal-link view-user-profile" href="https://devzone.nordicsemi.com/members/jarz"&gt;Jakub Rzeszutko&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/a&gt;&amp;nbsp;said, it works and the &amp;quot;app_util.h&amp;quot; has no error now. But,like&amp;nbsp;&lt;a class="internal-link view-user-profile" href="https://devzone.nordicsemi.com/members/awneil"&gt;awneil&lt;/a&gt;&amp;nbsp;said, there are&amp;nbsp;&lt;span&gt;many other areas which also need modifications&amp;mdash;&amp;mdash; The linker can not find &amp;rdquo;nrf_pwr_mgmt_init&amp;ldquo; and &amp;rdquo;nrf_pwr_mgmt_run&amp;ldquo;：&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/TIM_2A62FE56_20190509141806.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;When I&amp;nbsp;temporarily comment out these two lines of code，the project build successfully and I can use lambda in main function.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/TIM_2A62FE56_20190509141731.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Why the linker can not find &amp;rdquo;nrf_pwr_mgmt_init&amp;ldquo; and &amp;rdquo;nrf_pwr_mgmt_run&amp;ldquo;?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Build example project using C++11 with SEGGER_IDE failed</title><link>https://devzone.nordicsemi.com/thread/185964?ContentTypeID=1</link><pubDate>Wed, 08 May 2019 12:30:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fd7408ad-5962-4022-b969-d517d3bad365</guid><dc:creator>awneil</dc:creator><description>[quote userid="18697" url="~/f/nordic-q-a/47043/build-example-project-using-c-11-with-segger_ide-failed/185878"]I am aware of these discussions[/quote]
&lt;p&gt;Yes, I&amp;#39;m sure you are - I was addressing &lt;a href="https://devzone.nordicsemi.com/members/mjt110"&gt;mjt110&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;sorry for confusion.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Build example project using C++11 with SEGGER_IDE failed</title><link>https://devzone.nordicsemi.com/thread/185878?ContentTypeID=1</link><pubDate>Wed, 08 May 2019 09:11:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:59807516-cece-4dbb-989b-a962631b4b0b</guid><dc:creator>Jakub Rzeszutko</dc:creator><description>&lt;p&gt;I am aware of these discussions.&amp;nbsp;&lt;em&gt;Designated Initialisers&lt;/em&gt;&amp;nbsp;will be supported in C++ 20&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&amp;nbsp;I had major problem with this to change it to constructors. This adds a lot of extra code with ifdefs to our current macros.&lt;/p&gt;
&lt;p&gt;What makes me more worry about C++ is a big warning I saw in Keil that MicroLIB is not C++ compatible.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Build example project using C++11 with SEGGER_IDE failed</title><link>https://devzone.nordicsemi.com/thread/185876?ContentTypeID=1</link><pubDate>Wed, 08 May 2019 09:09:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b98955c5-ed2b-4fb7-9d4d-daf92ba24231</guid><dc:creator>awneil</dc:creator><description>[quote userid="18697" url="~/f/nordic-q-a/47043/build-example-project-using-c-11-with-segger_ide-failed/185871"]It is not so easy as one may think to support C99 and various of C++ standards for all compilers[/quote]
&lt;p&gt;Yes, I appreciate that!&lt;/p&gt;
&lt;p&gt;Not sure that &lt;a href="https://devzone.nordicsemi.com/members/mjt110"&gt;mjt110&lt;/a&gt; does, though?&lt;/p&gt;
[quote userid="18697" url="~/f/nordic-q-a/47043/build-example-project-using-c-11-with-segger_ide-failed/185871"]So far Nordic is officially supporting C[/quote]
&lt;p&gt;Indeed - there is no claim that it&amp;#39;s C++&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Build example project using C++11 with SEGGER_IDE failed</title><link>https://devzone.nordicsemi.com/thread/185872?ContentTypeID=1</link><pubDate>Wed, 08 May 2019 09:03:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:671f6be9-7b58-4b89-8ff8-3066e44fa4ff</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;But you will find many other areas which also need modifications.&lt;/p&gt;
&lt;p&gt;In particular, the extensive use of &lt;em&gt;Designated Initialisers&lt;/em&gt;&amp;nbsp;&amp;nbsp;- often via complex macros.&lt;/p&gt;
&lt;p&gt;Again, there have been posts on this before - and some contributors have shared their C++ compatible re-workings...&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/search?q=C%2B%2B"&gt;https://devzone.nordicsemi.com/search?q=C%2B%2B&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;EDIT&lt;/p&gt;
&lt;p&gt;See &lt;a href="https://devzone.nordicsemi.com/members/jarz"&gt;Jakub Rzeszutko&lt;/a&gt;&amp;#39;s reply above - which explains some of the issues, and the scale of the task.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Build example project using C++11 with SEGGER_IDE failed</title><link>https://devzone.nordicsemi.com/thread/185871?ContentTypeID=1</link><pubDate>Wed, 08 May 2019 08:59:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9356f9e5-a143-48fc-9fea-7175fb269dcd</guid><dc:creator>Jakub Rzeszutko</dc:creator><description>&lt;p&gt;Hi awneil,&lt;/p&gt;
&lt;p&gt;It is not so easy as one may think to support C99 and various of C++ standards for all compilers: Keil, GCC, SES, IAR.&lt;/p&gt;
&lt;p&gt;Currently I am porting one library to be C++ compatible and I am facing C++ standard issues. What compiles in older C++ standards won&amp;#39;t compile beginning from C++ 11 but it will compile in C++ 20. And the build result is diffrent depending on used compiler (in terms of building/not building).&lt;br /&gt;So far Nordic is officially supporting C but we have recently started&amp;nbsp;making C++ friendly code as much as possible. However migrating all available libraries to C++ is rather not feasable.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Build example project using C++11 with SEGGER_IDE failed</title><link>https://devzone.nordicsemi.com/thread/185865?ContentTypeID=1</link><pubDate>Wed, 08 May 2019 08:49:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:498dc182-7680-42b9-a94a-eb2068e8c81b</guid><dc:creator>Jakub Rzeszutko</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You can modify code a bit:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#ifdef __GNUC__
#ifdef __cplusplus
#define STATIC_ASSERT_SIMPLE(EXPR)      extern char (*_do_assert(void)) [sizeof(char[1 - 2*!(EXPR)])]
#define STATIC_ASSERT_MSG(EXPR, MSG)    extern char (*_do_assert(void)) [sizeof(char[1 - 2*!(EXPR)])]
#else
#define STATIC_ASSERT_SIMPLE(EXPR)      _Static_assert(EXPR, &amp;quot;unspecified message&amp;quot;)
#define STATIC_ASSERT_MSG(EXPR, MSG)    _Static_assert(EXPR, MSG)
#endif
#endif&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This will compile just fine.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Build example project using C++11 with SEGGER_IDE failed</title><link>https://devzone.nordicsemi.com/thread/185839?ContentTypeID=1</link><pubDate>Wed, 08 May 2019 07:37:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:06710e1d-f042-4afc-b4e2-5bc00404f075</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;Yes, it is well known that the standard Nordic code will not build as C++&lt;/p&gt;
&lt;p&gt;There has been a number of threads on it ...&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>