Discussion:
does Inline::CPP recognize #import ?
Xiao Yafeng
2012-07-22 11:28:42 UTC
Permalink
I have to use #import to import typed library , but seems Inline::CPP
doesn't know this and complain many errors:

use Inline CPP=>Config=>
CC => 'cl.exe',
BUILD_NOISY => 1;
use Inline CPP=><<'EOF';
#import "C:\Program Files\Common Files\Microsoft Shared\office11\mso.dll"
rename("DocumentProperties", "DocumentPropertiesXL") rename("RGB", "RBGXL")
#import "C:\Program Files\Common Files\Microsoft
Shared\VBA\VBA6\vbe6ext.olb"
#import "C:\Program Files\Microsoft Office\Office11\EXCEL.EXE"
rename("DialogBox", "DialogBoxXL") rename("RGB", "RBGXL")
rename("DocumentProperties", "DocumentPropertiesXL") rename("ReplaceText",
"ReplaceTextXL") rename("CopyFile", "CopyFileXL") no_dual_interfaces
using namespace std;

void test(){
printf("hello world\n");
}
EOF

test();

Error messages:

C:\Perl\bin\perl.exe C:\Perl\site\lib\ExtUtils\xsubpp -typemap
"C:\Perl
\lib\ExtUtils\typemap" test_cpp_pl_57db.xs > test_cpp_pl_57db.xsc &&
C:\Perl\bi
n\perl.exe -MExtUtils::Command -e mv -- test_cpp_pl_57db.xsc
test_cpp_pl_57db.c
cl.exe -c -I"C:/" -nologo -GF -W3 -MD -Zi -DNDEBUG -O1 -DWIN32
-D_CONS
OLE -DNO_STRICT -DHAVE_DES_FCRYPT -DUSE_SITECUSTOMIZE
-DPERL_IMPLICIT_CONTEXT -D
PERL_IMPLICIT_SYS -DUSE_PERLIO -D_USE_32BIT_TIME_T -DPERL_MSVCRT_READFIX
-MD -Zi
-DNDEBUG -O1 -DVERSION=\"0.00\" -DXS_VERSION=\"0.00\"
"-IC:\Perl\lib\CORE"
test_cpp_pl_57db.c
test_cpp_pl_57db.c
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(39) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(39) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(41) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(41) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(41) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(41) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(41) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(41) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(42) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(42) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(42) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(42) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(42) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(42) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(43) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(43) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(43) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(43) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(43) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(43) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(44) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(44) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(44) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(44) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(44) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(44) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(45) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(45) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(45) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(45) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(45) : error
C2143
: syntax error : missing '{' before ':'
..........
.........


Any ideas?
Sisyphus
2012-07-22 14:27:37 UTC
Permalink
----- Original Message -----
From: "Xiao Yafeng" <xyf.xiao-***@public.gmane.org>
To: "inline" <inline-***@public.gmane.org>; "David Oswald" <daoswald-***@public.gmane.org>
Sent: Sunday, July 22, 2012 9:28 PM
Subject: does Inline::CPP recognize #import ?
Post by Xiao Yafeng
I have to use #import to import typed library , but seems Inline::CPP
use Inline CPP=>Config=>
CC => 'cl.exe',
BUILD_NOISY => 1;
If you want to use cl.exe as a C++ compiler, you'll need to do
CC => 'cl /TP',

otherwise the source files will be treated as C files.

Was Inline::CPP originally installed using a different "CC" ?
If so, then it might cause problems if you decide to switch to cl.exe. (Or
it may not ... I don't know.)

If I wanted to switch to another compiler then, instead of using the 'CC'
config option, I would re-build and re-install Inline::CPP using that other
compiler. (But make sure you specify 'cl /TP' as the compiler.)
If you're using ActivePerl, you might just get away with that ... but if
you're running Strawberry Perl, then switching to a Microsoft compiler might
cause problems.
Post by Xiao Yafeng
test_cpp_pl_57db.c
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(39) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(39) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(41) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(41) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(41) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(41) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(41) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(41) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(42) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(42) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(42) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(42) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(42) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(42) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(43) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(43) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(43) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(43) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(43) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(43) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(44) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(44) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(44) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(44) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(44) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(44) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(45) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(45) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(45) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(45) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(45) : error
C2143
: syntax error : missing '{' before ':'
Note that this is Visual Studio complaining about its own cstdio file -
which also probably indicates that this C++ file (cstdio) is being parsed as
a C file.

Cheers,
Rob
Xiao Yafeng
2012-07-22 15:44:39 UTC
Permalink
Thanks for your helps, Rob!
I've tried to reinstall Inline::CPP with cl /TP but can't pass test. here
is the steps:

open a VS command prompt to be sure ENV settings is correct.
perl Makefile.PL
This will configure and build Inline::C++.
What default C++ compiler would you like to use? [cl -TP] cl /TP
What default libraries would you like to include? [MSVCIRT.LIB]
Writing Makefile for Inline::CPP::grammar
Writing MYMETA.yml and MYMETA.json
Writing Makefile for Inline::CPP
Writing MYMETA.yml and MYMETA.json
C:\Perl\cpan\build\Inline-CPP-0.31-FhHfET>
C:\Perl\cpan\build\Inline-CPP-0.31-FhHfET>nmake

Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.

cp CPP.pm blib\lib\Inline\CPP.pm
cp lib/Inline/CPP.pod blib\lib\Inline\CPP.pod
C:\PROGRA~1\MICROS~1.0\VC\BIN\nmake.exe -f Makefile all -nologo
cp grammar.pm ..\blib\lib\Inline\CPP\grammar.pm
cd ..

C:\Perl\cpan\build\Inline-CPP-0.31-FhHfET>nmake test

Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.

C:\PROGRA~1\MICROS~1.0\VC\BIN\nmake.exe -f Makefile all -nologo
cd ..
C:\Perl\bin\perl.exe "-MExtUtils::Command::MM" "-e"
"test_harness(0, 'bl
ib\lib', 'blib\arch')" t/*.t
t/01basic.t ...
Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.

C:\Perl\bin\perl.exe C:\Perl\site\lib\ExtUtils\xsubpp -typemap
"C:\Perl
\lib\ExtUtils\typemap" -typemap
"C:\Perl\cpan\build\Inline-CPP-0.31-FhHfET\_Inli
ne\build\_01basic_t_5cd2\CPP.map" _01basic_t_5cd2.xs > _01basic_t_5cd2.xsc
&& C
:\Perl\bin\perl.exe -MExtUtils::Command -e mv -- _01basic_t_5cd2.xsc
_01basic_t_
5cd2.c
cl /TP -c -I"C:/Perl/cpan/build/Inline-CPP-0.31-FhHfET/t" -nologo
-GF
-W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT
-DUSE_
SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO
-D_USE_32
BIT_TIME_T -DPERL_MSVCRT_READFIX -MD -Zi -DNDEBUG -O1 -DVERSION=\"0.00\"
-DX
S_VERSION=\"0.00\" "-IC:\Perl\lib\CORE" _01basic_t_5cd2.c
_01basic_t_5cd2.c
_01basic_t_5cd2.xs(2) : fatal error C1083: Cannot open include file:
'iostream.h
': No such file or directory
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio
9.0\VC\BIN
\cl.EXE"' : return code '0x2'
Stop.

A problem was encountered while attempting to compile and install your
Inline
CPP code. The command that failed was:
C:\PROGRA~1\MICROS~1.0\VC\BIN\nmake.exe > out.make 2>&1

The build directory was:
C:\Perl\cpan\build\Inline-CPP-0.31-FhHfET\_Inline\build\_01basic_t_5cd2

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

at t/01basic.t line 30.
BEGIN failed--compilation aborted at t/01basic.t line 64.
t/01basic.t ... Dubious, test returned 2 (wstat 512, 0x200)
Failed 10/10 subtests
t/02prefix.t ..
Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.

C:\Perl\bin\perl.exe C:\Perl\site\lib\ExtUtils\xsubpp -typemap
"C:\Perl
\lib\ExtUtils\typemap" -typemap
"C:\Perl\cpan\build\Inline-CPP-0.31-FhHfET\_Inli
ne\build\_02prefix_t_4ede\CPP.map" _02prefix_t_4ede.xs >
_02prefix_t_4ede.xsc &
& C:\Perl\bin\perl.exe -MExtUtils::Command -e mv -- _02prefix_t_4ede.xsc
_02pref
ix_t_4ede.c
cl /TP -c -I"C:/Perl/cpan/build/Inline-CPP-0.31-FhHfET/t" -nologo
-GF
-W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT
-DUSE_
SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO
-D_USE_32
BIT_TIME_T -DPERL_MSVCRT_READFIX -MD -Zi -DNDEBUG -O1 -DVERSION=\"0.00\"
-DX
S_VERSION=\"0.00\" "-IC:\Perl\lib\CORE" _02prefix_t_4ede.c
_02prefix_t_4ede.c
_02prefix_t_4ede.xs(2) : fatal error C1083: Cannot open include file:
'iostream.
h': No such file or directory
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio
9.0\VC\BIN
\cl.EXE"' : return code '0x2'
Stop.

A problem was encountered while attempting to compile and install your
Inline
CPP code. The command that failed was:
C:\PROGRA~1\MICROS~1.0\VC\BIN\nmake.exe > out.make 2>&1

The build directory was:
C:\Perl\cpan\build\Inline-CPP-0.31-FhHfET\_Inline\build\_02prefix_t_4ede

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

at t/02prefix.t line 0.
INIT failed--call queue aborted.
t/02prefix.t .. Dubious, test returned 2 (wstat 512, 0x200)
Failed 4/4 subtests

Test Summary Report
-------------------
t/01basic.t (Wstat: 512 Tests: 0 Failed: 0)
Non-zero exit status: 2
Parse errors: Bad plan. You planned 10 tests but ran 0.
t/02prefix.t (Wstat: 512 Tests: 0 Failed: 0)
Non-zero exit status: 2
Parse errors: Bad plan. You planned 4 tests but ran 0.
Files=2, Tests=0, 7 wallclock secs ( 0.03 usr + 0.03 sys = 0.06 CPU)
Result: FAIL
Failed 2/2 test programs. 0/0 subtests failed.
NMAKE : fatal error U1077: 'C:\Perl\bin\perl.exe' : return code '0x2'
Stop.

IIRC checking iostream.h is an old bug and fixed in new inline::CPP? or
was I missing something?


BTW. I'm using active perl with MinGW.
Post by Sisyphus
Sent: Sunday, July 22, 2012 9:28 PM
Subject: does Inline::CPP recognize #import ?
I have to use #import to import typed library , but seems Inline::CPP
Post by Xiao Yafeng
use Inline CPP=>Config=>
CC => 'cl.exe',
BUILD_NOISY => 1;
If you want to use cl.exe as a C++ compiler, you'll need to do
CC => 'cl /TP',
otherwise the source files will be treated as C files.
Was Inline::CPP originally installed using a different "CC" ?
If so, then it might cause problems if you decide to switch to cl.exe. (Or
it may not ... I don't know.)
If I wanted to switch to another compiler then, instead of using the 'CC'
config option, I would re-build and re-install Inline::CPP using that other
compiler. (But make sure you specify 'cl /TP' as the compiler.)
If you're using ActivePerl, you might just get away with that ... but if
you're running Strawberry Perl, then switching to a Microsoft compiler
might cause problems.
test_cpp_pl_57db.c
Post by Xiao Yafeng
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(39) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(39) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(41) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(41) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(41) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(41) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(41) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(41) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(42) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(42) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(42) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(42) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(42) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(42) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(43) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(43) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(43) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(43) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(43) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(43) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(44) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(44) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(44) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(44) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(44) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(44) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(45) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(45) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(45) : error
C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(45) : error
C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(45) : error
C2143
: syntax error : missing '{' before ':'
Note that this is Visual Studio complaining about its own cstdio file -
which also probably indicates that this C++ file (cstdio) is being parsed
as a C file.
Cheers,
Rob
Sisyphus
2012-07-23 00:48:42 UTC
Permalink
----- Original Message -----
From: "Xiao Yafeng"
Post by Xiao Yafeng
C:\Perl\cpan\build\Inline-CPP-0.31-FhHfET>nmake test
Try the latest version of Inline-CPP. It will hopefully detect that
iostream.h is not present and set things up so that iostream is used
instead.

Cheers,
Rob
Xiao Yafeng
2012-07-23 05:14:46 UTC
Permalink
installed Inline::CPP 0.39, but situation doesn't change:

use strict;
use warnings;
use Inline CPP=>Config=>
CC => 'cl.exe /TP',
BUILD_NOISY => 1;
use Inline CPP=><<'EOF';
#import "C:\Program Files\Common Files\Microsoft Shared\office11\mso.dll"
rename
("DocumentProperties", "DocumentPropertiesXL") rename("RGB", "RBGXL")
#import "C:\Program Files\Common Files\Microsoft
Shared\VBA\VBA6\vbe6ext.olb"
#import "C:\Program Files\Microsoft Office\Office11\EXCEL.EXE"
rename("DialogBox
", "DialogBoxXL") rename("RGB", "RBGXL") rename("DocumentProperties",
"DocumentP
ropertiesXL") rename("ReplaceText", "ReplaceTextXL") rename("CopyFile",
"CopyFil
eXL") no_dual_interfaces
using namespace std;

void test(){
;
}
EOF

test();


ERROR messages:

Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.

C:\Perl\bin\perl.exe C:\Perl\site\lib\ExtUtils\xsubpp -typemap
"C:\Perl
\lib\ExtUtils\typemap" test_cpp_pl_06b1.xs > test_cpp_pl_06b1.xsc &&
C:\Perl\bi
n\perl.exe -MExtUtils::Command -e mv -- test_cpp_pl_06b1.xsc
test_cpp_pl_06b1.c
cl.exe /TP -c -I"C:/" -nologo -GF -W3 -MD -Zi -DNDEBUG -O1
-DWIN32 -D_
CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DUSE_SITECUSTOMIZE
-DPERL_IMPLICIT_CONTEX
T -DPERL_IMPLICIT_SYS -DUSE_PERLIO -D_USE_32BIT_TIME_T
-DPERL_MSVCRT_READFIX -MD
-Zi -DNDEBUG -O1 -DVERSION=\"0.00\" -DXS_VERSION=\"0.00\"
"-IC:\Perl\lib\C
ORE" test_cpp_pl_06b1.c
test_cpp_pl_06b1.c
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) :
warning C
4530: C++ exception handler used, but unwind semantics are not enabled.
Specify
/EHsc
test_cpp_pl_06b1.xs(19) : error C2059: syntax error : '('
c:\program files\microsoft sdks\windows\v6.0a\include\msxml.h(1479) : error
C205
9: syntax error : '('
c:\program files\microsoft sdks\windows\v6.0a\include\msxml.h(1479) : error
C223
8: unexpected token(s) preceding ';'
c:\program files\microsoft sdks\windows\v6.0a\include\msxml.h(7989) : error
C205
9: syntax error : '('
c:\program files\microsoft sdks\windows\v6.0a\include\msxml.h(7989) : error
C223
8: unexpected token(s) preceding ';'
c:\program files\microsoft sdks\windows\v6.0a\include\msxml.h(8007) : error
C205
9: syntax error : '('
c:\program files\microsoft sdks\windows\v6.0a\include\msxml.h(8007) : error
C223
8: unexpected token(s) preceding ';'
c:\program files\microsoft sdks\windows\v6.0a\include\msxml.h(8010) : error
C205
9: syntax error : '('
c:\program files\microsoft sdks\windows\v6.0a\include\msxml.h(8010) : error
C223
8: unexpected token(s) preceding ';'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\ocidl.h(1667) : error
C205
9: syntax error : '('
C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\ocidl.h(1667) : error
C223
8: unexpected token(s) preceding ';'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\comutil.h(244) :
error C
2059: syntax error : '<L_TYPE_raw>'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\comutil.h(244) :
error C
2238: unexpected token(s) preceding ';'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\comutil.h(547) :
error C
2059: syntax error : '('
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\comutil.h(554) :
error C
2039: 'm_Data' : is not a member of '_bstr_t::Data_t'
C:\Program Files\Microsoft Visual Studio
9.0\VC\INCLUDE\comutil.h(218) :
see declaration of '_bstr_t::Data_t'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\comutil.h(554) :
error C
2039: 'm_Data' : is not a member of '_bstr_t::Data_t'
C:\Program Files\Microsoft Visual Studio
9.0\VC\INCLUDE\comutil.h(218) :
see declaration of '_bstr_t::Data_t'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\comutil.h(554) :
error C
2232: '->_bstr_t::Data_t::Length' : left operand has '' type, use '.'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\comutil.h(833) :
error C
2589: '(' : illegal token on right side of '::'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\comutil.h(833) :
error C
2143: syntax error : missing ';' before '::'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\comutil.h(833) :
error C
2059: syntax error : '::'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\comutil.h(834) :
error C
2143: syntax error : missing ';' before '{'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\comutil.h(834) :
error C
2447: '{' : missing function header (old-style formal list?)
c:\_inline\build\test_cpp_pl_06b1\mso.tlh : fatal error C1903: unable to
recover
from previous error(s); stopping compilation
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio
9.0\VC\BIN
\cl.exe"' : return code '0x2'
Stop.

A problem was encountered while attempting to compile and install your
Inline
CPP code. The command that failed was:
C:\PROGRA~1\MICROS~1.0\VC\BIN\nmake.exe

The build directory was:
C:\_Inline\build\test_cpp_pl_06b1

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

at test_cpp.pl line 26.
BEGIN failed--compilation aborted at test_cpp.pl line 35.
----- Original Message ----- From: "Xiao Yafeng"
C:\Perl\cpan\build\Inline-CPP-**0.31-FhHfET>nmake test
Try the latest version of Inline-CPP. It will hopefully detect that
iostream.h is not present and set things up so that iostream is used
instead.
Cheers,
Rob
Sisyphus
2012-07-23 06:08:34 UTC
Permalink
----- Original Message -----
From: "Xiao Yafeng" <xyf.xiao-***@public.gmane.org>
To: "Sisyphus" <sisyphus1-sFbbPxZDHXw0n/***@public.gmane.org>
Cc: "inline" <inline-***@public.gmane.org>; "David Oswald" <daoswald-***@public.gmane.org>
Sent: Monday, July 23, 2012 3:14 PM
Subject: Re: does Inline::CPP recognize #import ?
Post by Xiao Yafeng
use strict;
use warnings;
use Inline CPP=>Config=>
CC => 'cl.exe /TP',
Bad advice from me.
Looks like the default is 'cl -TP -EHsc' (which should have been the default
suggested during the 'perl Makefile.PL' step, and which is what you should
use).
So try that instead.

It still might not work.

The main problem is that we don't seem to have an Inline::CPP expert who
also understands the C++ idiosyncracies of MS compilers.
(I fail to qualify on both counts - in fact I don't know C++ at all.)

If it's possible for you to test :
What happens if you try the same test script using an Inline::C and
Inline-CPP-0.39 that was built for a MinGW (gcc) compiler ?

Cheers,
Rob
Xiao Yafeng
2012-07-23 10:00:28 UTC
Permalink
I tried but apparently C compiler doesn't recognize some C++ only grammar:

test_cpp_pl_06b1.xs(5) : error C2773: #import and #using available only in
C++ c
ompiler
test_cpp_pl_06b1.xs(6) : error C2773: #import and #using available only in
C++ c
ompiler
test_cpp_pl_06b1.xs(7) : error C2773: #import and #using available only in
C++ c
ompiler
test_cpp_pl_06b1.xs(8) : error C2061: syntax error : identifier 'namespace'
test_cpp_pl_06b1.xs(8) : error C2059: syntax error : ';'
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio
9.0\VC\BIN
\cl.EXE"' : return code '0x2'
Stop.

To me,
There seems be 2 ways to do:

1. compile a dll then call it from a Inline::C/CPP script

2. below is messages in buildlog of VS, maybe I can find something useful?

Command Lines


Creating temporary file "c:\Documents and Settings\Administrator\My
Documents\Visual Studio
2008\Projects\call_excel\call_excel\Debug\RSP000001352410128.rsp" with
contents
[
/Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE"
/Gm /EHsc /RTC1 /MDd /Fo"Debug\\" /Fd"Debug\vc90.pdb" /W3 /c /ZI /TP
".\call_excel.cpp"
]
Creating command line "cl.exe @"c:\Documents and
Settings\Administrator\My Documents\Visual Studio
2008\Projects\call_excel\call_excel\Debug\RSP000001352410128.rsp"
/nologo /errorReport:prompt"
Creating temporary file "c:\Documents and Settings\Administrator\My
Documents\Visual Studio
2008\Projects\call_excel\call_excel\Debug\RSP000002352410128.rsp" with
contents
[
/OUT:"C:\Documents and Settings\Administrator\My Documents\Visual
Studio 2008\Projects\call_excel\Debug\call_excel.exe" /INCREMENTAL
/MANIFEST /MANIFESTFILE:"Debug\call_excel.exe.intermediate.manifest"
/MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG
/PDB:"c:\Documents and Settings\Administrator\My Documents\Visual
Studio 2008\Projects\call_excel\Debug\call_excel.pdb"
/SUBSYSTEM:WINDOWS /ENTRY:"main" /DYNAMICBASE /NXCOMPAT /MACHINE:X86
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
odbccp32.lib

".\Debug\call_excel.obj"

".\Debug\call_excel.exe.embed.manifest.res"
]
Creating command line "link.exe @"c:\Documents and
Settings\Administrator\My Documents\Visual Studio
2008\Projects\call_excel\call_excel\Debug\RSP000002352410128.rsp"
/NOLOGO /ERRORREPORT:PROMPT"
Creating temporary file "c:\Documents and Settings\Administrator\My
Documents\Visual Studio
2008\Projects\call_excel\call_excel\Debug\RSP000003352410128.rsp" with
contents
[
/out:".\Debug\call_excel.exe.embed.manifest" /notify_update /manifest

".\Debug\call_excel.exe.intermediate.manifest"
]
Creating command line "mt.exe @"c:\Documents and
Settings\Administrator\My Documents\Visual Studio
2008\Projects\call_excel\call_excel\Debug\RSP000003352410128.rsp"
/nologo"
Creating temporary file "c:\Documents and Settings\Administrator\My
Documents\Visual Studio
2008\Projects\call_excel\call_excel\Debug\BAT000004352410128.bat" with
contents
[
@echo Manifest resource last updated at %TIME% on %DATE% > ".\Debug\mt.dep"
]
Creating command line """c:\Documents and Settings\Administrator\My
Documents\Visual Studio
2008\Projects\call_excel\call_excel\Debug\BAT000004352410128.bat"""

Output Window

Compiling...
call_excel.cpp
Linking...
Embedding manifest...

Results

Build log was saved at "file://c:\Documents and
Settings\Administrator\My Documents\Visual Studio
2008\Projects\call_excel\call_excel\Debug\BuildLog.htm"
call_excel - 0 error(s), 0 warning(s)
Post by Sisyphus
Sent: Monday, July 23, 2012 3:14 PM
Subject: Re: does Inline::CPP recognize #import ?
Post by Xiao Yafeng
use strict;
use warnings;
use Inline CPP=>Config=>
CC => 'cl.exe /TP',
Bad advice from me.
Looks like the default is 'cl -TP -EHsc' (which should have been the
default suggested during the 'perl Makefile.PL' step, and which is what you
should use).
So try that instead.
It still might not work.
The main problem is that we don't seem to have an Inline::CPP expert who
also understands the C++ idiosyncracies of MS compilers.
(I fail to qualify on both counts - in fact I don't know C++ at all.)
What happens if you try the same test script using an Inline::C and
Inline-CPP-0.39 that was built for a MinGW (gcc) compiler ?
Cheers,
Rob
Sisyphus
2012-07-24 01:36:14 UTC
Permalink
----- Original Message -----
From: "Xiao Yafeng"
Post by Xiao Yafeng
To me,
1. compile a dll then call it from a Inline::C/CPP script
If you want to call functions in the dll from your Inline::C/CPP script then
you'll also need to have an import lib for the dll.
Then you link to that import lib in the Inline config section with:

LIBS => '-LC:/location -lmylib',

(There may be other ways to do it, but that would be the simplest afaik.)
Post by Xiao Yafeng
2. below is messages in buildlog of VS, maybe I can find something useful?
I don't know.

Cheers,
Rob

Loading...