I still think there's too many unknowns for us to be of much help. What happens when you run the following script (called try.pl):
use strict; use warnings; use Inline CPP => <<'EOC'; #include "main.h" int CCC; char GlobalArr[13] = {'G','l','o','b','a','l',' ','a','r','r','a',' +y','\0'}; MyClass myGlobalInstance(GlobalArr) ; int add(int x, int y) { char arr[7]={'i','n',' ','a','d','d','\0'}; MyClass mc(arr); myGlobalInstance.wow(); return x + y; } EOC print add(7, 5);
For me, I get the following fatal errors:
try_pl_13b2.xs:15:18: main.h: No such file or directory try_pl_13b2.xs:18: error: `MyClass' does not name a type try_pl_13b2.xs: In function `int add(int, int)': try_pl_13b2.xs:22: error: `MyClass' was not declared in this scope try_pl_13b2.xs:22: error: expected `;' before "mc" try_pl_13b2.xs:23: error: `myGlobalInstance' was not declared in this +scope dmake: Error code 129, while making 'try_pl_13b2.o'
But then I don't have 'main.h' so at least some of those failures are not surprising.

If I ever find out what 'main.h' contains (and where it is located), why/if those 'use lib' directives are necessary, and why/if those 'use Inline CPP => Config' parameters are necessary, then I might be able to offer better help. (And the same might hold for others, too. I'm actually fairly hopeless when it comes to C++, and I hope it remains that way ... so you might not get much help from me, in any event :-)

One thing I did notice which I think is almost certainly incorrect is:
use Inline CPP => Config => INC => '-l/users/nirf/perlTrials/inlineExa +mple';
Did you mean:
use Inline CPP => Config => INC => '-I/users/nirf/perlTrials/inlineExa +mple';
Cheers,
Rob

In reply to Re^6: inline in a perl module by syphilis
in thread inline in a perl module by nirf1

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.