PERL: Using Inline C for Windows - Urgent!


  I am trying to get Inline C working on my computer. I get the following error when I try to run:

  use Inline C;
    void greet(char* name) {
      printf("Hello %s!\n", name);

   Which is basically a "hello world" program and I should imagine would work the first time.

   The error is:

Microsoft (R) Program Maintenance Utility   Version 1.50
Copyright (c) Microsoft Corp 1988-94. All rights reserved.

        C:\Perl\bin\perl.exe C:\Perl\lib\ExtUtils/xsubpp  -typemap C:\Perl\lib\ExtUtils\typemap  testInlineC_pl_6a6
f.xs > testInlineC_pl_6a6f.xsc && C:\Perl\bin\perl.exe -MExtUtils::Command -e mv testInlineC_pl_6a6f.xsc testInline
        cl -c  -IC:/OCR/Dev  -nologo -Gf -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT
   -DVERSION=\"0.00\"  -DXS_VERSION=\"0.00\"  "-IC:\Perl\lib\CORE"   testInlineC_pl_6a6f.c
C:\Perl\lib\CORE\perl.h(380) : fatal error C1083: Cannot open include file: 'sys/types.h': No such file or director
NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code '0x2'

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:

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

 at line 0
INIT failed--call queue aborted.

Things to note:

1. I saw already and followed the steps that Kandura noted.

2. My path is:
PATH=c:\program files\imagemagick;c:\program files\sdb\programs\bin;c:\program files\sdb\programs\pgm;C:\WINDOWS\sy
stem32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;c:\perl\bin;c:\mysql\bin;C:\Program Files\ActiveState Komodo 3.0\;C:\Per
l\bin\;c:\Python22;C:\Program Files\M
icrosoft Visual Studio .NET\Common7\Tools;C:\Program Files\Microsoft Visual Studio .NET\Common7\Tools\Bin;C:\Progra
m Files\Microsoft Visual Studio .NET\Common7\Tools\Bin\winnt;C:\Program Files\Microsoft Visual Studio .NET\vc7;C:\P
rogram Files\Microsoft Visual Studio .NET\Vc7\bin;c:\program files\Microsoft Visual Studio .Net\Common7\IDE\;

3. cl.exe and link.exe are both at: C:\P
rogram Files\Microsoft Visual Studio .NET\Vc7\bin which is in my path.

4. The error is slightly different than what ShakeySteve encountered. I admit that my original error was the same as his; it was only after I did the same steps he took that I got the error message above:

C:\Perl\lib\CORE\perl.h(380) : fatal error C1083: Cannot open include file: 'sys/types.h': No such file or director
NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code '0x2'

  are the new lines in the error message. I'm not sure how to proceed.


   Thanks in advance for any help you might give! I'd really like to get Inline C working.


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Isn't it the 42 ? You can only pass it a char * which means that '42' would be ok but not 42 without the quotes
sapbucketAuthor Commented:
That isn't it. I commented out greet(42); and I still get the same error message.
Something is wrong with the linking and compiling.

I tried searching for types.h and it was at c:\program files\Microsoft Visual Studio .Net\vc7\sys so I added that folder to my path. The script still didn't work because I still get the same error: "Cannot open include file: 'sys/types.h'".

I then opened perl.h and changed the include statement to the FULL path to where types.h is. LO AND BEHOLD - it had a new error message:

C:\Perl\lib\CORE\perl.h(391) : fatal error C1083: Cannot open include file: 'stdarg.h': No such file or directory
NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code '0x2'

Which is just the next include statement in perl.h.

SO, how do i specify the #include so that I do not have to use full filepath names? Is there a system variable (i would guess called INCLUDE) that C++ uses? The #include ignores the system PATH variable already because I HAVE all these folders in PATH.

Where the heck does C++ "look" when compiling #include statements? I do not know C++ but in PERL if I needed anything I would push @INC the path to the folder I want.

I looked up here on experts exchange and found:
You have 3 possibilities

You can place the complete path to the file, something like.....

#include "c:\development\myProj\Include\xxx.h"

2) If the include directory is a directory where include files from all projects can be included

you can do

Tools -> Options -> Projects -> VC++ Directories -> Include files and add the directory there.

3) you can do nonubik suggestion.
Suggestion number 2 would be the same as using number 3 for every project you use in Visual Studio......

And I tried 1.) and it worked, but now I have to do this for every #include???!?! THat is crazy. I also tried 2.) and it looked great - I included the folders needed - but even after that things were not working.

Thanks again anyone.


sapbucketAuthor Commented:

I found INCLUDE and LIB system variables. I copied and pasted the paths of include statements that throw an error. This got me through compilation - now I need to address the paths for the linker.

LINK : fatal error LNK1181: cannot open input file 'oldnames.lib'
NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code '0x49d'

Hello Ingy!


So can anyone explain why I had such problems with the paths for all the files? Why did I have to do this by hand and why isn't it automatically accomplished?

C is so strange. Everytime I deal with it it takes about 50-100 times longer to generate a solution then with PERL. Go figure.

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

I dont do perl but every 9 months or so I write a few thousand lines of C and then forget it all again ... and I always get grief about include files and paths. I've never managed to consistently make something work first time yet although there's probably loads of people on here who understand it well enough (or have enough spare time) to get it working first time !!

glad it works anyway
I think you would should your points back on this if you raise a question in community support.
should=get ! sorry
sapbucketAuthor Commented:
OK, I never did understand the whole points thing. I just pay the monthly fee to ask questions. Says I have "unlimited" points on my login page.

How should I go about assigning the points? How do I "raise a question in community support"  plq?

Any user or admin know what I should do with these 500 points? I answered my own question.

If you have paid then you have unlimited points it doesn't really matter if you give them to me or get them back. I have the points I need for this month so it wont make any difference to me either. To get your points back you have to raise a question in the community support topic area and paste a link to this question

this Q =
Dont want a grade C. Please ask community support to give your points back

sapbucketAuthor Commented:

   if you walk me through it I will - I'm not sure what "community support" is.

I have asked community support to refund for you.
Unaccepted per request http:Q_21206749.html

Question PAQ'd
500 points refunded.

Community Support Moderator

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.