Windows 10 Issue: C2099: initializer is not a constant
EmmanuelOga opened this issue · 4 comments
While using Janet 1.8.1 (installed with x64 exe installer) and VSCode 2017 or VSCode 2019 compiler, when I try to install the jaylib module I get an error C2099. Log attached below.
C:\Users\emman\workspace\janet\sandbox>jpm install https://github.com/janet-lang/jaylib.git
From https://github.com/janet-lang/jaylib
* branch master -> FETCH_HEAD
Already up to date.
no dependencies found
compiling build\src___main.obj...
Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27038 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
main.c
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(203): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(204): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(205): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(206): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(207): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(208): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(209): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(210): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(211): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(212): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(213): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(214): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(215): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(216): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(217): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(218): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(219): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(220): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(221): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(222): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(223): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(224): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(225): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(226): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(227): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(228): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(229): error C2099: initializer is not a constant
Error building git repository dependency: command exited with status 2
Since Raylib does not work with MSVC due to being pure C99, there isn’t much I can do here.
Basically jaylib does not work on windows right now.
Just double checked, this is in the README.
Apparently raylib builds with mingw on windows. I found that there's a vcpkg for it:
https://github.com/microsoft/vcpkg/tree/master/ports/raylib
I wonder if there's a way to tell janet where to look for a lib or dll.
OTOH having janet understand vcpkg could be interesting to solve the issue of cross platform 3rd party for a lot of useful dependencies ... 😃
Anyway, I don't expect that to happen as a solution to this particular issue, just a 2 cent idea.
I got it to compile by copying the initialization literals from raylib.h into jaylib/types.h
I also had to change a couple of function names (CloseWindow, ShowCursor and ShowBuffer i think) as they collided with functions in winuser.h (maybe also another windows header) but I suspect the include path I used (stock x64 native build tools command prompt for vs2017) was just overcrowded, didn't try to clean that up yet, but other than this jaylib compiles fine using Janet 1.9.1 jpm build
under windows 10