Skip to content

Building Perl 5.40.1 in C++ mode with Visual Studio 2019 fails #23152

@etna

Description

@etna

As per title. When win32\Makefile is edited to enable the USE_CPLUSCPLUS= define option, the build fails instantly. Build environment is Windows 11 with VS 2019 Community.

Build output is as follow:

D:\Sources\perl-5.40.1\perl-5.40.1\win32>nmake

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

        if not exist ".\mini" mkdir ".\mini"
        copy config_H.vc .\mini\config.h
        1 file(s) copied.
        cl -c -Imini -nologo -GF -W3 -MD -TP -EHsc -std:c++20 -I.\include -I. -I.. -DWIN32 -D_CONSOLE -DNO_STRICT -DWIN64 -D_CRT_SECURE_NO_DEPRECATE  -D_CRT_NONSTDC_NO_DEPRECATE -D_WINSOCK_DEPRECATED_NO_WARNINGS -DPERLDLL -DPERL_CORE   -O1 -Zi -GL -fp:precise -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -Fo.\mini\av.obj ..\av.c
cl : Command line warning D9002 : ignoring unknown option '-std:c++20'
av.c
d:\sources\perl-5.40.1\perl-5.40.1\inline.h(1169): warning C4804: '<=': unsafe use of type 'bool' in operation
d:\sources\perl-5.40.1\perl-5.40.1\inline.h(1164): warning C4018: '<=': signed/unsigned mismatch
..\av.c(288): warning C4244: 'argument': conversion from '__int64' to 'I32', possible loss of data
..\av.c(359): warning C4244: 'argument': conversion from '__int64' to 'I32', possible loss of data
..\av.c(436): warning C4244: 'argument': conversion from '__int64' to 'const I32', possible loss of data
..\av.c(884): warning C4244: 'argument': conversion from '__int64' to 'U32', possible loss of data
..\av.c(1174): warning C4244: 'argument': conversion from '__int64' to 'I32', possible loss of data
        cl -c -Imini -nologo -GF -W3 -MD -TP -EHsc -std:c++20 -I.\include -I. -I.. -DWIN32 -D_CONSOLE -DNO_STRICT -DWIN64 -D_CRT_SECURE_NO_DEPRECATE  -D_CRT_NONSTDC_NO_DEPRECATE -D_WINSOCK_DEPRECATED_NO_WARNINGS -DPERLDLL -DPERL_CORE   -O1 -Zi -GL -fp:precise -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -Fo.\mini\caretx.obj ..\caretx.c
cl : Command line warning D9002 : ignoring unknown option '-std:c++20'
caretx.c
d:\sources\perl-5.40.1\perl-5.40.1\inline.h(1169): warning C4804: '<=': unsafe use of type 'bool' in operation
d:\sources\perl-5.40.1\perl-5.40.1\inline.h(1164): warning C4018: '<=': signed/unsigned mismatch
        cl -c -Imini -nologo -GF -W3 -MD -TP -EHsc -std:c++20 -I.\include -I. -I.. -DWIN32 -D_CONSOLE -DNO_STRICT -DWIN64 -D_CRT_SECURE_NO_DEPRECATE  -D_CRT_NONSTDC_NO_DEPRECATE -D_WINSOCK_DEPRECATED_NO_WARNINGS -DPERLDLL -DPERL_CORE   -O1 -Zi -GL -fp:precise -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -Fo.\mini\class.obj ..\class.c
cl : Command line warning D9002 : ignoring unknown option '-std:c++20'
class.c
d:\sources\perl-5.40.1\perl-5.40.1\inline.h(1169): warning C4804: '<=': unsafe use of type 'bool' in operation
d:\sources\perl-5.40.1\perl-5.40.1\inline.h(1164): warning C4018: '<=': signed/unsigned mismatch
..\class.c(199): warning C4267: 'initializing': conversion from 'size_t' to 'U32', possible loss of data
..\class.c(289): warning C4244: 'initializing': conversion from 'UV' to 'U32', possible loss of data
..\class.c(290): warning C4244: 'initializing': conversion from 'UV' to 'U32', possible loss of data
..\class.c(297): warning C4244: 'initializing': conversion from 'UV' to 'U32', possible loss of data
..\class.c(421): warning C4804: '-': unsafe use of type 'bool' in operation
..\class.c(428): warning C4804: '-': unsafe use of type 'bool' in operation
..\class.c(446): warning C4804: '-': unsafe use of type 'bool' in operation
..\class.c(580): error C2059: syntax error: '.'
..\class.c(583): error C2143: syntax error: missing ';' before '}'
..\class.c(583): error C2059: syntax error: '}'
..\class.c(584): error C2143: syntax error: missing ';' before '{'
..\class.c(584): error C2447: '{': missing function header (old-style formal list?)
..\class.c(585): error C2059: syntax error: '}'
..\class.c(585): error C2143: syntax error: missing ';' before '}'
..\class.c(667): warning C4244: 'initializing': conversion from 'PADOFFSET' to 'U32', possible loss of data
..\class.c(880): warning C4244: 'initializing': conversion from 'PADOFFSET' to 'U32', possible loss of data
..\class.c(1057): error C2059: syntax error: '.'
..\class.c(1060): error C2143: syntax error: missing ';' before '}'
..\class.c(1060): error C2059: syntax error: '}'
..\class.c(1061): error C2143: syntax error: missing ';' before '{'
..\class.c(1061): error C2447: '{': missing function header (old-style formal list?)
..\class.c(1064): error C2059: syntax error: ','
..\class.c(1065): error C2143: syntax error: missing ';' before '{'
..\class.c(1065): error C2447: '{': missing function header (old-style formal list?)
..\class.c(1066): error C2059: syntax error: '}'
..\class.c(1066): error C2143: syntax error: missing ';' before '}'
NMAKE : fatal error U1077: 'D:\VisualStudio2019\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\cl.EXE' : return code '0x2'
Stop.

Any advice on how this can be resolved will be greatly appreciated.
By the way, a 'normal' build with USE_CPLUSCPLUS commented out succeeds.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions