Could anyone of you help me in solving an issue I am facing while linking C++ lib and headers with Perl using H2xs?
I have done the following:
1. First I write a C source file and its header file.
2. Create the new module using “c:/perl/bin/h2xs -n Remote::Connection
3. I adjust the Makefile.pl by adding the following line:
$CC = 'cl';
CC => $CC,
LD => '$(CC)',
DEFINE => '', # e.g., '-DHAVE_SOMETHING'
INC => ' -I/C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\include -I/C:\Program Files\Microsoft Visual Studio 8\VC\include', # e.g., '-I. -I/usr/include/other'
'OBJECT' => '$(O_FILES)',
4. Do some changes in default Connection.pm file (Added the function which I need to perform).
5. Create test.pl file
6. Add C++ code in Connection.xs
7. I have placed the project C++ Source file n header file in c: /perl/bin/Remote::Connection
8. In the cmd prompt I say c:/perl/bin/
Remote::Connection /perl makefile.pl
9. When I run nmake on the cmd prompt I get the following error msg:
Microsoft (R) Program Maintenance Utility Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.
cp lib/Remote/Connection.pm blib\lib\Remote\Connection.pm
C:\Perl\bin\perl.exe C:\Perl\lib\ExtUtils\xsubpp -typemap C:\Perl\lib\ExtUtils\typemap -typemap typemap Connection.xs > Connection.xsc && C:\Perl\bin\
perl.exe -MExtUtils::Command -e mv Connection.xsc Connection.c -I/C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\include -I/C:\Program Files\Microsoft Visual Studio 8\VC\include -nologo -GF -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DUSE_SITECUSTOMIZE -DPRIVLIB_LAST_IN_INC -RL_IMPLICIT_CONTE
XT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX -MD -Zi -DNDEBUG -O1
-DVERSION=\"0.01\" -DXS_VERSION=\"0.01\" "-IC:\Perl\lib\CORE" Connection.c
cl : Command line warning D9024 : unrecognized source file type 'Files\Microsoft ', object file assumed
cl : Command line warning D9027 : source file 'Files\Microsoft' ignored
cl : Command line warning D9024 : unrecognized source file type 'Visual', object file assumed
cl : Command line warning D9027 : source file 'Visual' ignored
cl : Command line warning D9024 : unrecognized source file type 'Studio', object file assumed
cl : Command line warning D9027 : source file 'Studio' ignored
cl : Command line warning D9024 : unrecognized source file type '8\VC\atlmfc\include', object file assumed
cl : Command line warning D9027 : source file '8\VC\atlmfc\include' ignored
cl : Command line warning D9024 : unrecognized source file type 'Files\Microsoft', object file assumed
cl : Command line warning D9027 : source file 'Files\Microsoft' ignored
cl : Command line warning D9024 : unrecognized source file type 'Visual', object
file assumed
cl : Command line warning D9027 : source file 'Visual' ignored
cl : Command line warning D9024 : unrecognized source file type 'Studio', object
file assumed
cl : Command line warning D9027 : source file 'Studio' ignored
cl : Command line warning D9024 : unrecognized source file type '8\VC\include',object file assumed
cl : Command line warning D9027 : source file '8\VC\include' ignored Connection.c
C:\Program Files\Microsoft Visual Studio 8\VC\ATLMFC\INCLUDE\afxv_w32.h(16) : fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 8\VC\BIN\c l.EXE"' : return code '0x2'
Stop.
Is there any thing that I am missing while specifying the path of the lib.
Please let me know your comments.
How do I link all the MFC apps (Vc++ Header files, lib and Dll) with h2xs (Command line).
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.