samirpatry has asked for the wisdom of the Perl Monks concerning the following question:


Hi Monks

I am intrested to integrate the C code in my perl program,so i try to execute a small program on INline.
#!C:/perl/bin/perl.exe -w #!/usr/bin/perl -w use strict; use Inline C => <<END_OF_C; int add(int x, int y) { return x+y; } END_OF_C print add(3, 4), "\n";

First it ask me load the Inline Pm ,so i install it in my system .Now the program execute but gives some error.

Error:

'nmake' is not recognized as an internal or external command,operable program or batch file.

A problem was encountered while attempting to compile and install your Inline C code. The command that failed was: nmake > out.make 2>&1

The build directory was:

G:\PERL\MD5\_Inline\build\Perl_c_pl_5719

To debug the problem, cd to the build directory, and inspect the output files.

at Perl_c.pl line 5

BEGIN failed--compilation aborted at Perl_c.pl line 9.

I am not clear about the above error.so i want to know what exactly the problem is.Any help will help me a lot

Replies are listed 'Best First'.
Re: Problem In C Inline use????
by davido (Cardinal) on Oct 19, 2006 at 05:41 UTC

    Have you installed nmake.exe (outside link - download) on your system? That's a vital component, but because it's provided by Microsoft (not by the author of Inline), it has to be obtained separately.


    Dave


      I have already install the Nmake.exe in my perl directory and it will gives me three file like NMAKE,Readme and the NMake.err.
        I have already install the Nmake.exe in my perl directory

        Iirc, the nmake executable that you download (which is named something like 'nmake95.exe') is an "installer" program that you need to run in order to install a somewhat ancient version of nmake.exe. (There's a more recent version freely available somewhere on the MS website that offers better mileage.)

        What does running 'nmake /?' produce ?

        However, next you're faced with the issue of finding a compiler. If you're going to use Visual Studio, then it already comes with a more recent (and more functional) version of nmake, so you would be better to use it instead of the nmake that you've downloaded. And if you're going to use the MinGW compiler, then you're better off with 'dmake' which can be obtained from CPAN.

        Cheers,
        Rob
Re: Problem In C Inline use????
by syphilis (Archbishop) on Oct 19, 2006 at 05:48 UTC
    For Inline::C to work you'll need a make program (either nmake or dmake will do) and you'll need a compiler (either Visual Studio or MinGW).

    Strawberry/Vanilla Perl (which includes MinGW and dmake) will provide you with all you need to build and use Inline::C, but it's also not difficult to get it working with ActivePerl, if you want to go that way.

    Cheers,
    Rob