<?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>Trying to include C file in C++ Project</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/99144/trying-to-include-c-file-in-c-project</link><description>Hi, 
 I have created a C++ project for the edge impulse purpose. standalone its working and including my C files also working until I am not calling any C function from main cpp file. 
 As I am calling any function error is coming like undefined reference</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 27 Apr 2023 16:14:27 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/99144/trying-to-include-c-file-in-c-project" /><item><title>RE: Trying to include C file in C++ Project</title><link>https://devzone.nordicsemi.com/thread/422829?ContentTypeID=1</link><pubDate>Thu, 27 Apr 2023 16:14:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e1ff0930-c319-4779-95be-b4339ec1e331</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Sabir&lt;/p&gt;
&lt;p&gt;In order to call C functions from a C++ file you need to use the extern &amp;quot;C&amp;quot; declaration in the header of the C file, in order for the C++ linker to find the C functions.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This is explained in more detail &lt;a href="https://embeddedartistry.com/blog/2017/05/01/mixing-c-and-c-extern-c/"&gt;here&lt;/a&gt;, and you can see how the extern &amp;quot;C&amp;quot; declaration is used in the various Zephyr headers &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/main/include/zephyr/bluetooth/gatt.h#L28-L30"&gt;here&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>