<?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>C++ and SDK</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/83301/c-and-sdk</link><description>I am migrating my project to C++. Everything in the SDK works so far except NRF_BLE_GATT_DEF(). This returns the error C++ requires a type specifier for all declarations. Is there a workaround?</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 06 Jan 2022 17:28:34 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/83301/c-and-sdk" /><item><title>RE: C++ and SDK</title><link>https://devzone.nordicsemi.com/thread/346554?ContentTypeID=1</link><pubDate>Thu, 06 Jan 2022 17:28:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a59b3582-71e3-4481-9753-81a3cef01d68</guid><dc:creator>nick_haman</dc:creator><description>&lt;p&gt;Understood.&amp;nbsp; All other modules seem to work with C++ except usb_cdc_acm.&amp;nbsp; This thread might help those in the future going down this path.&amp;nbsp; It is a bit heavy handed modifying the SDK headers.&amp;nbsp; It would be great it there was a cleaner fix to this issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: C++ and SDK</title><link>https://devzone.nordicsemi.com/thread/346542?ContentTypeID=1</link><pubDate>Thu, 06 Jan 2022 16:00:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eb8e54fa-ff25-4997-a55a-556af552d032</guid><dc:creator>SwRa</dc:creator><description>&lt;p&gt;Hi Nick,&lt;/p&gt;
&lt;p&gt;It is a known issue that the macros used in the SDK are not well supported by C++. Our SDK is written to support C and some of the coding method is not well supported for C++. I will however ask around internally and will get back to you.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind Regards,&lt;/p&gt;
&lt;p&gt;Swathy&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: C++ and SDK</title><link>https://devzone.nordicsemi.com/thread/346295?ContentTypeID=1</link><pubDate>Wed, 05 Jan 2022 17:19:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:69b9ce97-b013-46fd-abfd-7217183c3242</guid><dc:creator>nick_haman</dc:creator><description>&lt;p&gt;SDK 16.0&amp;nbsp;using&amp;nbsp;&amp;nbsp;usb_cdc_acm example.&amp;nbsp; GCC with -std=C++11.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;My workaround so far has been to place the above definition and callback function in a C module and to pass the arguments to the real callback in the C++ module.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Also, when including&amp;nbsp;app_usbd_cdc_acm.h in the C++ module it complained about a forward enum declaration.&amp;nbsp; I had to move the enum declaration into the app_usbd_cdc_acm_internal.h file and protect it with a #define:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#ifndef _APP_USBD_CDC_
#define _APP_USBD_CDC_


	typedef enum app_usbd_cdc_acm_user_event_e {
		APP_USBD_CDC_ACM_USER_EVT_RX_DONE, /**&amp;lt; User event RX_DONE.    */
		APP_USBD_CDC_ACM_USER_EVT_TX_DONE, /**&amp;lt; User event TX_DONE.    */

		APP_USBD_CDC_ACM_USER_EVT_PORT_OPEN, /**&amp;lt; User event PORT_OPEN.  */
		APP_USBD_CDC_ACM_USER_EVT_PORT_CLOSE, /**&amp;lt; User event PORT_CLOSE. */
	} app_usbd_cdc_acm_user_event_t;
	
#endif // !_APP_USBD_CDC_

/*lint -save -e165*/
/**
 * @brief Forward declaration of @ref app_usbd_cdc_acm_user_event_e.
 *
 */
enum app_usbd_cdc_acm_user_event_e;
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: C++ and SDK</title><link>https://devzone.nordicsemi.com/thread/346291?ContentTypeID=1</link><pubDate>Wed, 05 Jan 2022 16:58:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0a5230ee-af7d-4930-96c7-d5ff1ae9368d</guid><dc:creator>Nguyen Hoan Hoang</dc:creator><description>&lt;p&gt;Data structure assignments must be in the order as the defined in the structure&amp;nbsp;in C++. &amp;nbsp;You need to re-order the assignments. &amp;nbsp;For example.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;typedef struct {
    int a;
    float b;
    char c;
} X_t;

// Wrong order, rejected by C++, accepted by C
X_t failedAssign = {
    .b = 1.0,
    .a = 3,
};

// Correct order, accepted by both
X_t goodAssign = {
    .a = 3;
    .b = 1.0,
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Unfortunately there are a lot of those in the SDK.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: C++ and SDK</title><link>https://devzone.nordicsemi.com/thread/346276?ContentTypeID=1</link><pubDate>Wed, 05 Jan 2022 16:04:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:46ec824a-ffd0-41d8-89d2-df79ad0e77aa</guid><dc:creator>SwRa</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Which example are you trying to convert to C++.? Also, which compiler are you using.?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Swathy&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: C++ and SDK</title><link>https://devzone.nordicsemi.com/thread/345991?ContentTypeID=1</link><pubDate>Tue, 04 Jan 2022 20:46:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:25f66b53-afd2-452a-a27e-47c3187b1c5a</guid><dc:creator>nick_haman</dc:creator><description>&lt;p&gt;Actually, when I convert it to int:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void cdc_acm_user_ev_handler(app_usbd_class_inst_t const * p_inst, int event);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Error designator order for field &amp;#39;app_usbd_cdc_acm_inst_t::comm_interface&amp;#39; does not match declaration order in &amp;#39;app_usbd_cdc_acm_inst_t&amp;#39;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: C++ and SDK</title><link>https://devzone.nordicsemi.com/thread/345989?ContentTypeID=1</link><pubDate>Tue, 04 Jan 2022 20:44:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ceda3b26-9c87-41e1-823d-8ae5f9d4324a</guid><dc:creator>nick_haman</dc:creator><description>&lt;p&gt;Another error occurs in the&amp;nbsp;APP_USBD_CDC_ACM_GLOBAL_DEF:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void cdc_acm_user_ev_handler(app_usbd_class_inst_t const * p_inst, app_usbd_cdc_acm_user_event_t event);

/**
 * @brief CDC_ACM class instance
 * */
APP_USBD_CDC_ACM_GLOBAL_DEF(m_app_cdc_acm,
	cdc_acm_user_ev_handler,
	CDC_ACM_COMM_INTERFACE,
	CDC_ACM_DATA_INTERFACE,
	CDC_ACM_COMM_EPIN,
	CDC_ACM_DATA_EPIN,
	CDC_ACM_DATA_EPOUT,
	APP_USBD_CDC_COMM_PROTOCOL_AT_V250);
	&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Error invalid conversion from &amp;#39;void (*)(const app_usbd_class_inst_t*, app_usbd_cdc_acm_user_event_t)&amp;#39; {aka &amp;#39;void (*)(const app_usbd_class_inst_s*, app_usbd_cdc_acm_user_event_e)&amp;#39;} to &amp;#39;app_usbd_cdc_acm_user_ev_handler_t&amp;#39; {aka &amp;#39;void (*)(const app_usbd_class_inst_s*, int)&amp;#39;}&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Changing the event type to int gives another error about initialization.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>