c – Perl XSPP – std :: string的多重定义
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了c – Perl XSPP – std :: string的多重定义,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1860字,纯文字阅读大概需要3分钟。
内容图文
![c – Perl XSPP – std :: string的多重定义](/upload/InfoBanner/zyjiaocheng/730/32a5d2fe5ed64efda1fae118c98d56cb.jpg)
我试图将一些Google URL Library功能作为perl模块公开.基于这里和其他地方的一些帖子,看起来XSPP可能是一个很好的起点.这是我到目前为止创建的内容(从googleurl lib的编译版本开始):
我创建了这个xspp文件(为简洁起见省略了一些方法):
#include "gurl.h"
%typemap{std::string};
%typemap{bool};
%module{Google::URL};
class GURL
{
%name{new} GURL(std::string& url);
~GURL();
bool is_valid();
bool is_empty();
std::string spec();
std::string possibly_invalid_spec();
std::string scheme();
std::string username();
std::string password();
std::string host();
std::string port();
std::string path();
std::string query();
std::string ref();
bool has_scheme();
bool has_username();
bool has_password();
bool has_host();
bool has_port();
bool has_path();
bool has_query();
bool has_ref();
};
我创建了这个Makefile.PL文件:
use 5.012;
use Module::Build::WithXSpp;
my $build = Module::Build::WithXSpp->new(
module_name => 'Google::URL::GURL',
license => 'perl',
extra_typemap_modules => {
'ExtUtils::Typemap::Default' => '0.01',
'ExtUtils::Typemap::STL' => '0.01',
},
extra_linker_flags => '-L../googleurl -lgoogleurl',
extra_compiler_flags => '-I. -I.. -I../googleurl -I../googleurl/base -I../googleurl/src',
);
然后我跑:
perl Makefile.PL && ./Build
..并得到以下错误:
WARNING: the following files are missing in your kit:
GURL.xs
Please inform the author.
Created MYMETA.yml and MYMETA.json
Creating new 'Build' script for 'Google-URL-GURL' version '0.01'
Building Google-URL-GURL
Processing XS typemap files...
Multiple definition of ctype 'std::string' in TYPEMAP section at ~/lib/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/ExtUtils/Typemaps.pm line 819.
有xspp经验的人有任何想法可能导致此错误吗?我可以在上面的GURL.xsp文件中成功运行xspp,它会产生对我来说合理的输出.
解决方法:
ExtUtils::Typemaps::Default的文档清楚地表明它已经包含ExtUtils::Typemaps::STL.如果你从extra_typemaps中删除后者,它应该都可以工作.
内容总结
以上是互联网集市为您收集整理的c – Perl XSPP – std :: string的多重定义全部内容,希望文章能够帮你解决c – Perl XSPP – std :: string的多重定义所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。