S
sleepymish
Hi,
I recently followed the Perlembed example and did a C program w/ perl
embedded. It worked fine. Then suddenly I realize I need to use C++
STL, which I can't do w/ C. Now I'm trying to convert my c program into
c++, except I'm not sure how to compile it w/ perl anymore. Here's how
I compile perl w/ my c program before:
$ gcc -O2 -Dbool=char -DHAS_BOOL -I/usr/local/include
-I/lib/perl5/5.8/cygwin/C
ORE -L/lib/perl5/5.8/cygwin/CORE -o p1v1 p1v1.c -lperl -lm
Now how would I compile a C++ program w/ perl embed? I tried the
following and it didn't work:
$ g++ -O2 -Dbool=char -DHAS_BOOL -I/usr/local/include
-I/lib/perl5/5.8/cygwin/C
ORE -L/lib/perl5/5.8/cygwin/CORE -o p1v1 p1v1.cpo -lperl -lm
$ g++ -O2 -Dbool=char -DHAS_BOOL -I/usr/local/include
-I/lib/perl5/5.8/cygwin/C
ORE -L/lib/perl5/5.8/cygwin/CORE -o p1v1 p1v1.cc -lperl -lm
Here's one sample errors:
$ gcc -O2 -Dbool=char -DHAS_BOOL -I/usr/local/include
-I/lib/perl5/5.8/cygwin/C
ORE -L/lib/perl5/5.8/cygwin/CORE -o p1v1 p1v1.cc -lperl -lmcd
In file included from /lib/perl5/5.8/cygwin/CORE/perl.h:2838,
from p1v1.cc:4:
/usr/include/ieeefp.h:185: error: previous declaration of `int
isnan(double)'
with C++ linkage
/usr/include/math.h:125: error: conflicts with new declaration with C
linkage
/usr/include/ieeefp.h:186: error: previous declaration of `int
isinf(double)'
with C++ linkage
/usr/include/math.h:126: error: conflicts with new declaration with C
linkage
/usr/include/ieeefp.h:187: error: previous declaration of `int
finite(double)'
with C++ linkage
/usr/include/math.h:127: error: conflicts with new declaration with C
linkage
/usr/include/ieeefp.h:191: error: previous declaration of `int
isnanf(float)'
with C++ linkage
/usr/include/math.h:240: error: conflicts with new declaration with C
linkage
/usr/include/ieeefp.h:192: error: previous declaration of `int
isinff(float)'
with C++ linkage
/usr/include/math.h:241: error: conflicts with new declaration with C
linkage
/usr/include/ieeefp.h:193: error: previous declaration of `int
finitef(float)'
with C++ linkage
/usr/include/math.h:242: error: conflicts with new declaration with C
linkage
In file included from p1v1.cc:10:
helpers.h: In function `void wget_file(char*, char*)':
helpers.h:6: error: invalid conversion from `void*' to `char*'
helpers.h: In function `int get_v(int, char**, char**, char*, int*)':
helpers.h:74: error: invalid conversion from `void*' to `char*'
helpers.h:75: error: invalid conversion from `void*' to `char*'
helpers.h: In function `int get_AvgDocLen(int, int, char**, char**)':
helpers.h:345: error: invalid conversion from `void*' to `char*'
helpers.h:368: error: invalid conversion from `void*' to `char*'
helpers.h:370: error: invalid conversion from `void*' to `int*'
p1v1.cc: In function `int main(int, char**, char**)':
p1v1.cc:38: error: invalid conversion from `void*' to `char*'
p1v1.cc:40: error: invalid conversion from `void*' to `char*'
p1v1.cc:41: error: invalid conversion from `void*' to `int*'
Someone please help!
Oh yea I did try ken fox's libperl but got the following after I run:
perl Makefile.PL
make
Syntax error: Unterminated quoted string
make: *** [subdirs] Error 2
I looked in the makefile and can't find an unterminated quoted string.
Anybody has any ideas?
P.S. I posted in the moderated forum too, but that takes too long to
update. I'm hoping I will get result faster here. Sorry for the
duplication.
Michelle
I recently followed the Perlembed example and did a C program w/ perl
embedded. It worked fine. Then suddenly I realize I need to use C++
STL, which I can't do w/ C. Now I'm trying to convert my c program into
c++, except I'm not sure how to compile it w/ perl anymore. Here's how
I compile perl w/ my c program before:
$ gcc -O2 -Dbool=char -DHAS_BOOL -I/usr/local/include
-I/lib/perl5/5.8/cygwin/C
ORE -L/lib/perl5/5.8/cygwin/CORE -o p1v1 p1v1.c -lperl -lm
Now how would I compile a C++ program w/ perl embed? I tried the
following and it didn't work:
$ g++ -O2 -Dbool=char -DHAS_BOOL -I/usr/local/include
-I/lib/perl5/5.8/cygwin/C
ORE -L/lib/perl5/5.8/cygwin/CORE -o p1v1 p1v1.cpo -lperl -lm
$ g++ -O2 -Dbool=char -DHAS_BOOL -I/usr/local/include
-I/lib/perl5/5.8/cygwin/C
ORE -L/lib/perl5/5.8/cygwin/CORE -o p1v1 p1v1.cc -lperl -lm
Here's one sample errors:
$ gcc -O2 -Dbool=char -DHAS_BOOL -I/usr/local/include
-I/lib/perl5/5.8/cygwin/C
ORE -L/lib/perl5/5.8/cygwin/CORE -o p1v1 p1v1.cc -lperl -lmcd
In file included from /lib/perl5/5.8/cygwin/CORE/perl.h:2838,
from p1v1.cc:4:
/usr/include/ieeefp.h:185: error: previous declaration of `int
isnan(double)'
with C++ linkage
/usr/include/math.h:125: error: conflicts with new declaration with C
linkage
/usr/include/ieeefp.h:186: error: previous declaration of `int
isinf(double)'
with C++ linkage
/usr/include/math.h:126: error: conflicts with new declaration with C
linkage
/usr/include/ieeefp.h:187: error: previous declaration of `int
finite(double)'
with C++ linkage
/usr/include/math.h:127: error: conflicts with new declaration with C
linkage
/usr/include/ieeefp.h:191: error: previous declaration of `int
isnanf(float)'
with C++ linkage
/usr/include/math.h:240: error: conflicts with new declaration with C
linkage
/usr/include/ieeefp.h:192: error: previous declaration of `int
isinff(float)'
with C++ linkage
/usr/include/math.h:241: error: conflicts with new declaration with C
linkage
/usr/include/ieeefp.h:193: error: previous declaration of `int
finitef(float)'
with C++ linkage
/usr/include/math.h:242: error: conflicts with new declaration with C
linkage
In file included from p1v1.cc:10:
helpers.h: In function `void wget_file(char*, char*)':
helpers.h:6: error: invalid conversion from `void*' to `char*'
helpers.h: In function `int get_v(int, char**, char**, char*, int*)':
helpers.h:74: error: invalid conversion from `void*' to `char*'
helpers.h:75: error: invalid conversion from `void*' to `char*'
helpers.h: In function `int get_AvgDocLen(int, int, char**, char**)':
helpers.h:345: error: invalid conversion from `void*' to `char*'
helpers.h:368: error: invalid conversion from `void*' to `char*'
helpers.h:370: error: invalid conversion from `void*' to `int*'
p1v1.cc: In function `int main(int, char**, char**)':
p1v1.cc:38: error: invalid conversion from `void*' to `char*'
p1v1.cc:40: error: invalid conversion from `void*' to `char*'
p1v1.cc:41: error: invalid conversion from `void*' to `int*'
Someone please help!
Oh yea I did try ken fox's libperl but got the following after I run:
perl Makefile.PL
make
Syntax error: Unterminated quoted string
make: *** [subdirs] Error 2
I looked in the makefile and can't find an unterminated quoted string.
Anybody has any ideas?
P.S. I posted in the moderated forum too, but that takes too long to
update. I'm hoping I will get result faster here. Sorry for the
duplication.
Michelle