我正在使用活动 perl 5.14.2。在这里,我尝试使用 Inline::C 在我的 perl 代码中使用 Windows C 库
use strict;
use Inline C => DATA =>
CCFLAGS => '-std:C99 -Tx86-coff -Zi -Ob1 -fp:precise -W1 -Gd -Ze -Go -D_USER_SPACE_' =>
INC => '"-ID:\test\incl"' =>
LIBS => '"-LD:\test\lib" -llib1 -llib2 -llib3 -llib4';
test();
__END__
__C__
#include <incl/hd1.h>
#include <stdio.h>
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
void test(void) {
.........
当我尝试运行脚本时,它失败并出现以下错误
Warning. No Inline C functions bound to Perl in .\test.pl
Check your C function definition(s) for Inline compatibility
Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Perl5.14\bin\perl.exe C:\Perl5.14\lib\ExtUtils\xsubpp -typemap "C:\Perl5.14\lib\ExtUtils\typemap" test_pl_7fbb.xs > test_pl_7fbb.xsc && C:\Perl5.14\bin\perl.exe -M
ExtUtils::Command -e "mv" -- test_pl_7fbb.xsc test_pl_7fbb.c
cl -c -I"D:/test" "-ID:\test\incl" -std:C99 -Tx86-coff -Zi -Ob1 -fp:precise -W1 -Gd -Ze -Go -D_USER_SPACE_ -MD -Zi -DNDEBUG -O1 -DVERSIO
N=\"0.00\" -DXS_VERSION=\"0.00\" "-IC:\Perl5.14\lib\CORE" test_pl_7fbb.c
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\cl.EXE"' : return code '0xc0000135'
Stop.
A problem was encountered while attempting to compile and install your Inline
C code. The command that failed was:
C:\PROGRA~2\MICROS~1.0\VC\bin\nmake.exe > out.make 2>&1
The build directory was:
D:\test\_Inline\build\test_pl_7fbb
To debug the problem, cd to the build directory, and inspect the output files.
at .\test.pl line 0
...propagated at C:/Perl5.14/site/lib/Inline/C.pm line 772.
INIT failed--call queue aborted.
PS D:\cmapl_test> perl -v
This is perl 5, version 14, subversion 2 (v5.14.2) built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail)
Copyright 1987-2011, Larry Wall
Binary build 1402 [295342] provided by ActiveState http://www.ActiveState.com
Built Oct 7 2011 15:49:44
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
我尝试使用以下命令构建 test_pl_7fbb.c 文件:
cl -c "-ID:\test" "-ID:\test\include" -std:C99 -Tx86-coff -Zi -Ob1 -fp:precise -W1 -
Gd -Ze -Go -D_USER_SPACE_ -MD -Zi -DNDEBUG -O1 "-DVERSION=0.00"
"-DXS_VERSION=0.00" "-IC:\Perl5.14\lib\CORE" test_pl_7fbb.c
它没有错误地完成。
我猜 Inline 在编译时使用的选项 -I"D:/test" 导致了这个问题。
提前感谢您对此的任何帮助。