【发布时间】:2014-04-25 01:06:08
【问题描述】:
我有一个大约 15,000 行的 Perl 脚本,我想用 PerlInterpreter 从用 C++ 编译的 Windows 可执行文件中执行它。
我试过了,关注these directions
我下载了 Perl 5.18 源代码并包含了核心(安装)目录,分别用于 perl.h 和 EXTERN.h,以及 core/win32 和 core/win32/include
然后我尝试在 Visual Studio 2013 中编译简单的 C++ 项目
#include <EXTERN.h> /* from the Perl distribution */
#include <perl.h> /* from the Perl distribution */
static PerlInterpreter *my_perl; /*** The Perl interpreter ***/
int main(int argc, char **argv, char **env)
{
PERL_SYS_INIT3(&argc,&argv,&env);
my_perl = perl_alloc();
perl_construct(my_perl);
PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
perl_parse(my_perl, NULL, argc, argv, (char **)NULL);
perl_run(my_perl);
perl_destruct(my_perl);
perl_free(my_perl);
PERL_SYS_TERM();
}
项目没有编译,出现数百个错误,但最普遍的错误是
missing config.h file included by perl.h
所以我在perl.h 中添加了#define PERL_MICRO 语句
这将错误数量减少到 20 个
但是,所有错误都源自 Windows SDK 文件 string.h 和 guidedef.h
所以我不知道这些错误的根源是什么
谁能向我提供有关如何为 Perl 脚本创建和构建 C++ 解释器的任何信息?
剩下的错误是
Error 10 error C3861: 'my_memcmp': identifier not found c:\program files (x86)\windows kits\8.1\include\shared\guiddef.h 161 1
Error 3 error C2733: 'memmove_s' : second C linkage of overloaded function not allowed c:\program files (x86)\microsoft visual studio 12.0\vc\include\string.h 136 1
Error 4 error C2733: 'memmove' : second C linkage of overloaded function not allowed c:\program files (x86)\microsoft visual studio 12.0\vc\include\string.h 139 1
Error 2 error C2733: 'memcpy_s' : second C linkage of overloaded function not allowed c:\program files (x86)\microsoft visual studio 12.0\vc\include\string.h 57 1
Error 1 error C2733: 'memcpy' : second C linkage of overloaded function not allowed c:\program files (x86)\microsoft visual studio 12.0\vc\include\string.h 55 1
Error 8 error C2732: linkage specification contradicts earlier specification for 'strstr' c:\program files (x86)\microsoft visual studio 12.0\vc\include\string.h 228 1
Error 7 error C2732: linkage specification contradicts earlier specification for 'strrchr' c:\program files (x86)\microsoft visual studio 12.0\vc\include\string.h 226 1
Error 6 error C2732: linkage specification contradicts earlier specification for 'strpbrk' c:\program files (x86)\microsoft visual studio 12.0\vc\include\string.h 224 1
Error 5 error C2732: linkage specification contradicts earlier specification for 'strchr' c:\program files (x86)\microsoft visual studio 12.0\vc\include\string.h 222 1
Error 9 error C2732: linkage specification contradicts earlier specification for 'memchr' c:\program files (x86)\microsoft visual studio 12.0\vc\include\string.h 233 1
【问题讨论】:
-
您似乎在随意更改内容以试图摆脱错误消息;这不是一个好的工作方式。这些消息本身不是问题,但它们会提醒您需要解决的问题。我不确定您的问题的解决方案是什么,但破解 Perl 发布文件不是其中的一部分。如果您想为构建定义
PERL_MICRO,那么您需要修改您的 Visual Studio 项目来定义它。头文件构成了 Perl 编译器/解释器接口的定义,您不能随意更改它们。
标签: c++ perl visual-studio