<?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>Can&amp;#39;t call struct on another file or call the function in main code</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/93500/can-t-call-struct-on-another-file-or-call-the-function-in-main-code</link><description>Hi, 
 I am planning to create an ultrasonic library (based on ch201) because I can&amp;#39;t find any library for it. So I am porting code from ch201 development kit to nrf52 custom board. 
 So in my main code, I am defining a method for creating initialization</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 03 Nov 2022 15:32:30 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/93500/can-t-call-struct-on-another-file-or-call-the-function-in-main-code" /><item><title>RE: Can't call struct on another file or call the function in main code</title><link>https://devzone.nordicsemi.com/thread/393973?ContentTypeID=1</link><pubDate>Thu, 03 Nov 2022 15:32:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f3cfee65-bb1d-48e2-9d48-eba295db0cc8</guid><dc:creator>azwawe</dc:creator><description>&lt;p&gt;great, thanks. really helpful.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't call struct on another file or call the function in main code</title><link>https://devzone.nordicsemi.com/thread/393914?ContentTypeID=1</link><pubDate>Thu, 03 Nov 2022 13:48:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9812b521-fb97-43b8-b32a-a806a13007bd</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Imam&lt;/p&gt;
&lt;p&gt;Is ch201_device defined in a different header file than ch201_gprmt.h?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If so you need to include that header file at the top of ch201_gprmt.h, so that the ch201_device struct is defined at the point where you declare the ch201_gprmt_init function.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;For all of this to work make sure you are using &lt;a href="https://riptutorial.com/c/example/7662/header-include-guards"&gt;include guards&lt;/a&gt;, to ensure that you don&amp;#39;t define things multiple times (this would cause even more errors).&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>