Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

../pTk/mTk/xlib/X11/X.h:182:34: error: expected identifier or '(' before numeric constant #87

Open
hakonhagland opened this issue Oct 24, 2022 · 2 comments · May be fixed by #89
Open

Comments

@hakonhagland
Copy link

hakonhagland commented Oct 24, 2022

I have installed a debug version of perl 5.37.5 on Windows 11 using MinGW-w64 and gcc 11.3 from https://winlibs.com/ (using the MSVCRT runtime library), see Perl/perl5#20395 for more information on this.

When trying to install Tk with this perl I get:

>perl --version
This is perl 5, version 37, subversion 5 (v5.37.5-8-g382a566379) built for MSWin32-x64-multi-thread
[...]
>perl Makefile.PL
[...]
>gmake
[...]
gcc -c -I. -I./pTk/mTk/xlib  -I.. -I.. -I../pTk/mTk/xlib -I. -Ibitmaps -I.. -I../pTk/mTk/xlib -DWIN32 -DWIN64 -DDEBUGGING -DPERL_TEXTMODE_SCRIPTS -DMULTIPLICITY -DPERL_IMPLICIT_SYS -DUSE_PERLIO -D__USE_MINGW_ANSI_STDIO -fwrapv -fno-strict-aliasing -mms-bitfields -DPERLDLL -g -O0   -DVERSION=\"804.036\" -DXS_VERSION=\"804.036\"  "-IC:\perl-debug\lib\CORE"    exWinHandle.c
gcc -c -I. -I./pTk/mTk/xlib  -I.. -I.. -I../pTk/mTk/xlib -I. -Ibitmaps -I.. -I../pTk/mTk/xlib -DWIN32 -DWIN64 -DDEBUGGING -DPERL_TEXTMODE_SCRIPTS -DMULTIPLICITY -DPERL_IMPLICIT_SYS -DUSE_PERLIO -D__USE_MINGW_ANSI_STDIO -fwrapv -fno-strict-aliasing -mms-bitfields -DPERLDLL -g -O0   -DVERSION=\"804.036\" -DXS_VERSION=\"804.036\"  "-IC:\perl-debug\lib\CORE"    imgBMP.c
In file included from ../pTk/mTk/xlib/X11/Xlib.h:31,
                 from tkWinPort.h:19,
                 from tkPort.h:32,
                 from tk.h:87,
                 from imgBMP.c:11:
../pTk/mTk/xlib/X11/X.h:182:34: error: expected identifier or '(' before numeric constant
  182 | #define ControlMask             (1<<2)
      |                                  ^
gmake[1]: *** [makefile:891: imgBMP.o] Error 1
gmake[1]: Leaving directory 'C:/Users/hakon/perl/cpan-modules/Tk-804.036/pTk'
gmake: *** [makefile:1656: pTk/libpTk.a] Error 2

The complete output from the last two commands is here: perl-makefile.log, and gmake.log

A wild guess could be that this error happens because X.h, see line 182 defines ControlMask whereas ControlMask is already typedef'ed in another header file (processthreadsapi.h) pulled in from windows.h. I cannot find this header file as direct link online, but locally it is located in C:\Winlibs64-gcc11.3-msvcrt\mingw64\include. At line 163 of that file I have this typedef:

typedef struct _PROCESS_POWER_THROTTLING_STATE {
    ULONG Version;
    ULONG ControlMask;
    ULONG StateMask;
  } PROCESS_POWER_THROTTLING_STATE, *PPROCESS_POWER_THROTTLING_STATE;

hakonhagland added a commit to hakonhagland/perl-tk that referenced this issue Oct 25, 2022
The name "ControlMask" is already defined in processthreadsapi.h
OS=Win32.
Instead use "ControlMask2". See issue eserte#87 for more information.
@hakonhagland
Copy link
Author

could be that this error happens because X.h, see line 182 defines ControlMask whereas ControlMask is already typedef'ed in another header file

Yes, I think this is the case. See pull #88 for a possible fix.

@chrstphrchvz
Copy link
Contributor

This issue was already addressed by upstream Tcl/Tk, see https://core.tcl-lang.org/tk/info/9e31fd9449

I would prefer that Perl/Tk backport their approach for consistency; I will open a PR to do so.

chrstphrchvz pushed a commit to chrstphrchvz/perl-tk that referenced this issue Oct 25, 2022
@chrstphrchvz chrstphrchvz linked a pull request Oct 25, 2022 that will close this issue
chrstphrchvz pushed a commit to chrstphrchvz/perl-tk that referenced this issue Sep 5, 2023
eserte pushed a commit that referenced this issue Nov 5, 2023
eserte added a commit that referenced this issue Nov 5, 2023
eserte added a commit that referenced this issue Nov 5, 2023
eserte added a commit that referenced this issue Mar 10, 2024
Test for two constans from this module.
This is done in preparation for fixing #87.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants