hey guys,
this is my first posting, i've been googling for answers but so far no joy..
i'm trying to embed perl statements in C++ (g++ on linux
actually), and i've followed the perlembed doc,
which works great for C but when i try to include iostream
libraries (or any STL libraries) seems to have a problem.
here's what i've got:
// to compile do
// % g++ -o myperl myperl2.c `perl -MExtUtils::Embed -e ccopts -e ldopts`
#include <EXTERN.h> /* from the Perl distribution */
#include <perl.h> /* from the Perl distribution */
//#include <iostream> // this line is causing problems, probably the STL library conflict with perl
using namespace std;
static PerlInterpreter *my_perl; /*** The Perl interpreter ***/
int main(int argc, char **argv, char **env)
{
my_perl = perl_alloc();
perl_construct(my_perl);
perl_parse(my_perl, NULL, argc, argv, (char **)NULL);
perl_run(my_perl);
perl_destruct(my_perl);
perl_free(my_perl);
}
compilation works great (see the first program line)
but as soon as i uncomment the iostream library include,
i get a bunch of errors, i'm assuming library conflict.
Anybody else had this problem?
thanks!
Retitled by davido.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.