kcat / openal-soft

OpenAL Soft is a software implementation of the OpenAL 3D audio API.
Other
2.22k stars 536 forks source link

Errors with Visual Studio 2017 #1058

Open BeagleJoe opened 6 days ago

BeagleJoe commented 6 days ago

Version 1.24.0 error C2397: conversion from 'int' to 'uint64_t' requires a narrowing conversion

\al\source.cpp \alc\alc.cpp \alc\alconfig.cpp \alc\backends\wasapi.cpp \core\converter.cpp

kcat commented 5 days ago

Where does that happen? What MSVC version?

BeagleJoe commented 5 days ago

Where does that happen? I am trying to build openal-soft from source code. (https://github.com/kcat/openal-soft/archive/refs/tags/1.24.0.tar.gz)

What MSVC version? Microsoft Visual Studio Community 2017 Version 15.9.57 VisualStudio.15.Release/15.9.57+34031.82

OS is Windows 10

These errors occur during the build: (warnings omitted)

Error C2397 conversion from 'int' to 'uint64_t' requires a narrowing conversion \core\converter.cpp 227 Error C2397 conversion from 'int' to 'size_t' requires a narrowing conversion \alc\backends\wasapi.cpp 2227
Error C2397 conversion from 'int' to 'size_t' requires a narrowing conversion \alc\alconfig.cpp 260 Error C2397 conversion from 'int' to 'size_t' requires a narrowing conversion \alc\alc.cpp 3519
Error C2397 conversion from 'int' to 'size_t' requires a narrowing conversion \alc\alc.cpp 2434
Error C2397 conversion from 'int' to 'uint' requires a narrowing conversion \alc\alc.cpp 1264
Error C2397 conversion from '__int64' to 'uint64_t' requires a narrowing conversion \al\source.cpp 429 Error C2397 conversion from 'int' to 'uint64_t' requires a narrowing conversion \al\source.cpp 429

Hope this helps.

kcat commented 5 days ago

Looks like the compiler doesn't like "narrowing" a constexpr value, when the value needs to be known at compile time and it must know it fits in the new type. Are you able to upgrade MSVC? It seems to work with VS 17 (MSVC 19), if you're able to upgrade to at least that.