Thanks Sean.<br>Its really helpful.<br><br><div class="gmail_quote">On 29 March 2011 00:00, Sean Robert McGuffee <span dir="ltr">&lt;<a href="mailto:sean.mcguffee@gmail.com">sean.mcguffee@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><br>
RInside R(argc, argv); //this would appear to be a class called RInside<br>
definining a variable called R initialized with argc and argv variables.<br>
<br>
To declare it globally, you would need to define it inside a *.cpp file<br>
once, and only once. Usually this is easiest to do at the top of a *.cpp<br>
file that uses it. Then do the same thing in other files that use it, but in<br>
those cases, place the term &quot;extern&quot; in front of the declaration.<br>
<br>
Example:<br>
<br>
RInside R; //this is a declaration<br>
extern RInside R; //this is a line for another file that lets the compiler<br>
know it is declared in another *.cpp file.<br>
<br>
Then inside your main function where you must be to get the argc and argv<br>
variables, you could then initialize the class:<br>
R=RInside(argc,argv);<br>
<br>
I haven&#39;t ever used this class, and my instructions assume that a default<br>
constructor for RInside is accessible to you. If it were not, then you would<br>
have to make a pointer to it in the global scope and then assign it by<br>
reference:<br>
<br>
//outside of all {}&#39;s at the top of a *.cpp file:<br>
RInside *Rptr; //this is a pointer of type RInside declaration<br>
extern RInside *Rptr; //this is a line for another file that lets the<br>
compiler know Rptr is declared in another *.cpp file<br>
<br>
//inside main<br>
RInside R(argc, argv);<br>
Rptr=&amp;R;<br>
<br>
I hope this helps,<br>
<font color="#888888"><br>
Sean<br>
</font><div><div></div><div class="h5"><br>
<br>
<br>
On 3/26/11 10:18 AM, &quot;Dirk Eddelbuettel&quot; &lt;<a href="mailto:edd@debian.org">edd@debian.org</a>&gt; wrote:<br>
<br>
&gt;<br>
&gt; On 26 March 2011 at 19:06, nandan amar wrote:<br>
&gt; | Ohh Then i sud select reply to all<br>
&gt; |<br>
&gt; | Thanks Dirk,<br>
&gt; | But RInside R(argc, argv) is not a variable .<br>
&gt;<br>
&gt; If R is not a variable here, what is it?<br>
&gt;<br>
&gt; | How can I declare it globally or share its instance.<br>
&gt; | If it is not related to R/Rcpp please leave some related pointer.<br>
&gt;<br>
&gt; Sorry, but you simply need to read some more about C++ and or<br>
&gt; programming. Google for &#39;good c++ book&#39;. There is a free one I like at<br>
&gt;<br>
&gt;    <a href="http://www.icce.rug.nl/documents/cplusplus/" target="_blank">http://www.icce.rug.nl/documents/cplusplus/</a><br>
&gt;<br>
&gt; which is also included in Debian and Ubuntu as a package.<br>
&gt;<br>
&gt; Dirk<br>
<br>
<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><span style="color: rgb(0, 0, 0);">Amar Kumar Nandan</span><br style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);">Karnataka, India, 560100</span><br style="color: rgb(0, 0, 0);">
<span style="color: rgb(0, 0, 0);"><a href="http://aknandan.co.nr" target="_blank">http://aknandan.co.nr</a></span><br>