Judging from this: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=1773
We're never going to be able to rely on __cplusplus. It seems that g++ has been debating this issue for over a decade, and there's still no consensus on how to fix it in a way that would not break some OS ports of g++. Some compilers will report 1, and some will report a number greater than 199711 (which is supposed to be the standard way of indicating Standards compliance). <rant mode> >From reading that thread I just become disgusted at C++ in general and how it would be so much better served to scale back the size of the distribution, while at the same time implementing a broader functionality through a C++ version of CPAN. Sort of like how Perl maintains a relatively small core with a huge common repository of additional functionality (CPAN), much of which is widely tested, but none of which is causing the core language to fail to maintain some sort of cross-platform standard. And gnu c++ is a fly on a camel's back compared to any of the MS compilers. </end rant mode> Ok, back to work. If you roll back to 0.33_002 do you still have problems running code that calls cout or uses string? I am really bothered to think that just adding some #define's and attempting to use namespaces compatibly has broken something. Incidentally, BUK has resolved his Inline::CPP install issues. We don't need any further action there. However, installing Math::Prime::FastSieve fails for him, with the same sort of issues you're now identifying. So you and he stumbled into the same problem within a few hours of each other. Given that I use Strawberry Perl on Windows, and a couple versions of g++ compiled Perl on Linux, despite the fact that I have and use MS Visual C++ 2010 on other projects, I can't really test MS compiler related problems as they pertain to Inline::CPP. I suppose I could install Active State Perl on my Windows system, but I've never investigated how to get Active Perl co-existing with Strawberry Perl on the same Windows system. I don't think Perlbrew would be helpful there. I will be traveling starting the evening of 12/24 through 1/23, but it will be a "working vacation", so while there may be gaps in my availability, there will also be bursts of activity here and there. If I have time before I leave I'm going to work on a more thorough ToDo list. Dave On Fri, Dec 23, 2011 at 12:05 AM, Sisyphus <sisyph...@optusnet.com.au> wrote: > > ----- Original Message ----- From: "David Oswald" <daosw...@gmail.com> > To: "Sisyphus" <sisyph...@optusnet.com.au> > Sent: Friday, December 23, 2011 2:55 PM > > Subject: Re: Inline::CPP development version 0.33_003 uploaded to CPAN > > >> Can you boil that down to a test that doesn't use cout? I mean is it >> string or cout that is giving us grief? I want to test the smallest >> possible snippet of code that reproduces your problem. > > > > With just the 'cout << ... 'line commented out, just 2 unresolved symbols > when linking: > > ########################################################### > > Microsoft (R) Program Maintenance Utility Version 7.00.9466 > Copyright (C) Microsoft Corporation. All rights reserved. > > C:\_32\perl_vc7\5.10.0\bin\perl.exe > C:\_32\perl_vc7\5.10.0\lib\ExtUtils\xsubpp -typemap > "C:\_32\perl_vc7\5.10.0\lib\ExtUtils\typemap" davido_pl_6c77.xs > > davido_pl_6c77.xsc && C:\_32\perl_vc7\5.10.0\bin\perl.exe > -MExtUtils::Command -e mv davido_pl_6c77.xsc davido_pl_6c77.c > cl -TP /EHsc -c -nologo -GF -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE > -DNO_STRICT -DHAVE_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS > -DUSE_PERLIO -MD -Zi -DNDEBUG -O1 -DVERSION=\"0.00\" > -DXS_VERSION=\"0.00\" "-IC:\_32\perl_vc7\5.10.0\lib\CORE" > davido_pl_6c77.c > davido_pl_6c77.c > Running Mkbootstrap for davido_pl_6c77 () > C:\_32\perl_vc7\5.10.0\bin\perl.exe -MExtUtils::Command -e chmod 644 > davido_pl_6c77.bs > C:\_32\perl_vc7\5.10.0\bin\perl.exe -MExtUtils::Mksymlists -e > "Mksymlists('NAME'=>\"davido_pl_6c77\", 'DLBASE' => 'davido_pl_6c77', > 'DL_FUNCS' => { }, 'FUNCLIST' => [], 'IMPORTS' => { }, 'DL_VARS' => []);" > link -out:blib\arch\auto\davido_pl_6c77\davido_pl_6c77.dll -dll -nologo > -nodefaultlib -debug -opt:ref,icf > -libpath:"c:\_32\perl_vc7\5.10.0\lib\CORE" -machine:x86 davido_pl_6c77.obj > C:\_32\perl_vc7\5.10.0\lib\CORE\perl510.lib C:\vsnet\VC7\lib\MSVCIRT.LIB > C:\vsnet\VC7\lib\oldnames.lib C:\vsnet\VC7\lib\kernel32.lib > C:\vsnet\VC7\PlatformSDK\lib\user32.lib > C:\vsnet\VC7\PlatformSDK\lib\gdi32.lib > C:\vsnet\VC7\PlatformSDK\lib\winspool.lib > C:\vsnet\VC7\PlatformSDK\lib\comdlg32.lib > C:\vsnet\VC7\PlatformSDK\lib\advapi32.lib > C:\vsnet\VC7\PlatformSDK\lib\shell32.lib > C:\vsnet\VC7\PlatformSDK\lib\ole32.lib > C:\vsnet\VC7\PlatformSDK\lib\oleaut32.lib > C:\vsnet\VC7\PlatformSDK\lib\netapi32.lib > C:\vsnet\VC7\PlatformSDK\lib\uuid.lib > C:\vsnet\VC7\PlatformSDK\lib\ws2_32.lib C:\vsnet\VC7\PlatformSDK\lib\mpr.lib > C:\vsnet\VC7\PlatformSDK\lib\winmm.lib > C:\vsnet\VC7\PlatformSDK\lib\version.lib > C:\vsnet\VC7\PlatformSDK\lib\odbc32.lib > C:\vsnet\VC7\PlatformSDK\lib\odbccp32.lib C:\vsnet\VC7\lib\msvcrt.lib > -def:davido_pl_6c77.def > Creating library blib\arch\auto\davido_pl_6c77\davido_pl_6c77.lib and > object blib\arch\auto\davido_pl_6c77\davido_pl_6c77.exp > davido_pl_6c77.obj : error LNK2019: unresolved external symbol > "__declspec(dllimport) public: __thiscall std::basic_string<char,struct > std::char_traits<char>,class std::allocator<char> >>::~basic_string<char,struct std::char_traits<char>,class > std::allocator<char> >(void)" > (__imp_??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) > referenced in function "void __cdecl greet(void)" (?greet@@YAXXZ) > davido_pl_6c77.obj : error LNK2019: unresolved external symbol > "__declspec(dllimport) public: __thiscall std::basic_string<char,struct > std::char_traits<char>,class std::allocator<char> >>::basic_string<char,struct std::char_traits<char>,class > std::allocator<char> >(char const *)" > (__imp_??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z) > referenced in function "void __cdecl greet(void)" (?greet@@YAXXZ) > blib\arch\auto\davido_pl_6c77\davido_pl_6c77.dll : fatal error LNK1120: 2 > unresolved externals > > NMAKE : fatal error U1077: 'link' : return code '0x460' > Stop. > ########################################################### > > With the 'cout << ..' line reinstated, we get 4 unresolved externals: > > ########################################################### > > Microsoft (R) Program Maintenance Utility Version 7.00.9466 > Copyright (C) Microsoft Corporation. All rights reserved. > > C:\_32\perl_vc7\5.10.0\bin\perl.exe > C:\_32\perl_vc7\5.10.0\lib\ExtUtils\xsubpp -typemap > "C:\_32\perl_vc7\5.10.0\lib\ExtUtils\typemap" davido_pl_c4daa.xs > > davido_pl_c4daa.xsc && C:\_32\perl_vc7\5.10.0\bin\perl.exe > -MExtUtils::Command -e mv davido_pl_c4daa.xsc davido_pl_c4daa.c > cl -TP /EHsc -c -nologo -GF -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE > -DNO_STRICT -DHAVE_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS > -DUSE_PERLIO -MD -Zi -DNDEBUG -O1 -DVERSION=\"0.00\" > -DXS_VERSION=\"0.00\" "-IC:\_32\perl_vc7\5.10.0\lib\CORE" > davido_pl_c4daa.c > davido_pl_c4daa.c > > Running Mkbootstrap for davido_pl_c4daa () > C:\_32\perl_vc7\5.10.0\bin\perl.exe -MExtUtils::Command -e chmod 644 > davido_pl_c4daa.bs > > C:\_32\perl_vc7\5.10.0\bin\perl.exe -MExtUtils::Mksymlists -e > "Mksymlists('NAME'=>\"davido_pl_c4daa\", 'DLBASE' => 'davido_pl_c4daa', > 'DL_FUNCS' => { }, 'FUNCLIST' => [], 'IMPORTS' => { }, 'DL_VARS' => []);" > link -out:blib\arch\auto\davido_pl_c4daa\davido_pl_c4daa.dll -dll -nologo > -nodefaultlib -debug -opt:ref,icf > -libpath:"c:\_32\perl_vc7\5.10.0\lib\CORE" -machine:x86 > davido_pl_c4daa.obj C:\_32\perl_vc7\5.10.0\lib\CORE\perl510.lib > C:\vsnet\VC7\lib\MSVCIRT.LIB C:\vsnet\VC7\lib\oldnames.lib > C:\vsnet\VC7\lib\kernel32.lib C:\vsnet\VC7\PlatformSDK\lib\user32.lib > C:\vsnet\VC7\PlatformSDK\lib\gdi32.lib > C:\vsnet\VC7\PlatformSDK\lib\winspool.lib > C:\vsnet\VC7\PlatformSDK\lib\comdlg32.lib > C:\vsnet\VC7\PlatformSDK\lib\advapi32.lib > C:\vsnet\VC7\PlatformSDK\lib\shell32.lib > C:\vsnet\VC7\PlatformSDK\lib\ole32.lib > C:\vsnet\VC7\PlatformSDK\lib\oleaut32.lib > C:\vsnet\VC7\PlatformSDK\lib\netapi32.lib > C:\vsnet\VC7\PlatformSDK\lib\uuid.lib > C:\vsnet\VC7\PlatformSDK\lib\ws2_32.lib C:\vsnet\VC7\PlatformSDK\lib\mpr.lib > C:\vsnet\VC7\PlatformSDK\lib\winmm.lib > C:\vsnet\VC7\PlatformSDK\lib\version.lib > C:\vsnet\VC7\PlatformSDK\lib\odbc32.lib > C:\vsnet\VC7\PlatformSDK\lib\odbccp32.lib C:\vsnet\VC7\lib\msvcrt.lib > -def:davido_pl_c4daa.def > Creating library blib\arch\auto\davido_pl_c4daa\davido_pl_c4daa.lib and > object blib\arch\auto\davido_pl_c4daa\davido_pl_c4daa.exp > davido_pl_c4daa.obj : error LNK2019: unresolved external symbol > "__declspec(dllimport) public: __thiscall std::basic_string<char,struct > std::char_traits<char>,class std::allocator<char> >>::~basic_string<char,struct std::char_traits<char>,class > std::allocator<char> >(void)" > (__imp_??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) > referenced in function "void __cdecl greet(void)" (?greet@@YAXXZ) > davido_pl_c4daa.obj : error LNK2019: unresolved external symbol "class > std::basic_ostream<char,struct std::char_traits<char> > & __cdecl > std::operator<<(class std::basic_ostream<char,struct std::char_traits<char> >> &,class std::basic_string<char,struct std::char_traits<char>,class > std::allocator<char> > const &)" > (??6std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z) > referenced in function "void __cdecl greet(void)" (?greet@@YAXXZ) > > davido_pl_c4daa.obj : error LNK2001: unresolved external symbol > "__declspec(dllimport) class std::basic_ostream<char,struct > std::char_traits<char> > std::cout" > (__imp_?cout@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A) > davido_pl_c4daa.obj : error LNK2019: unresolved external symbol > "__declspec(dllimport) public: __thiscall std::basic_string<char,struct > std::char_traits<char>,class std::allocator<char> >>::basic_string<char,struct std::char_traits<char>,class > std::allocator<char> >(char const *)" > (__imp_??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z) > referenced in function "void __cdecl greet(void)" (?greet@@YAXXZ) > > blib\arch\auto\davido_pl_c4daa\davido_pl_c4daa.dll : fatal error LNK1120: 4 > unresolved externals > NMAKE : fatal error U1077: 'link' : return code '0x460' > Stop. > ########################################################### > > With both of the lines of code in greet() commented out, everything goes > fine .... but of course nothing happens. > > With C, the appearance of the "unresolved external symbol" usually means > there's a library that needs to be linked in (but currently isn't). > Is that the case here ? Or are we just seeing a consequence of the > name-mangling for which C++ is well known ? > > Juggling the inclusion/exclusion of 'string', 'string.h' and the > presence/removal of 'using namespace std;' achieves nothing - though it can > lead to the program failing at the compile stage instead of the link stage. > > This perhaps needs some input from someone who is fairly familiar with both > MS compilers and C++. > > >> I also think I want to rework the Makefile.PL trial-compilation to >> separately test headers and namespaces. >> >> Also, some C++ compilers that are standard compliant define __cplusplus to >> be some value over 200811 (or something like that; I would have to look it >> up) MS Visual C++ 2010 does this, but g++ sets it to 1, which I'm not sure >> if that signifies compliant or non. I think that if it's intended to >> signify compliance it's doing so in a non-compliant way (at least as C++ in >> a nutshell describes that definition). > > > MSVC++ 7.0 defines that as 1, as also does mingw's gcc-4.5.2. My x64 MS > compiler defines it as 199711. > > That'll have to do for now ... pub beckons ;-) > > Cheers, > Rob -- David Oswald daosw...@gmail.com