Failed building on Visual Studio 2022
c-buzz opened this issue · comments
System Information:
OS: Windows 11
Build Tool: MSVC VC17 Visual Studio 2022 | MSYS2 UCRT64 MinGW64 with Ninja
CMake 3.25.1
CMake Active Flags: IIR1_BUILD_DEMO | IIR1_BUILD_TESTING | IIR1_INSTALL_STATIC
Error Received (both build toolchains):
Severity Code Description Project File Line Suppression State
Error C3861 'random': identifier not found rbj_update C:\workspace\libs\iir1\demo\rbj_update.cpp 37
Looks like that random() is in "stdlib.h" so I've added that. Hope VC likes it now! Sorry can't test as I haven't got that configuration. Using VC2019.
As far as I can tell, on my PC, both MSVC for VC2019 and VC2022 have a function rand()
defined into <stdlib.h>
. No mention to random()
function. Anyhow, skimming here, I can understand that random()
is defined in glibc or POSIX.
I think using random()
should be a wide fix on both OS
It's just a demo. If rand() makes your compilers happier then let's stick with rand(). Just committed that.
Both right. rand(3) should be avoided on portable code, as in many implementations it's broken. I remember using it on Solaris and the results were alternately odd and even! random(3) is much better but it's a C++ library thing, not a POSIX thing (as I understand it). Even then, random_r(3) needs to be used for multi-threaded programs if you want repeatability.
As Bernd says though, it's just a demo. Both sound white (can you tell I've an audio background? ;) ).
Looks like that random() is in "stdlib.h" so I've added that. Hope VC likes it now! Sorry can't test as I haven't got that configuration. Using VC2019.
In demo//rbj_update.cpp, is there a reason that stdio.h
and stdlib.h
are being used instead of cstdio
and stdlib
? I don't know if that would make any difference.
The whole lib using the old convention.
@c-buzz does it compile now?
Closing it now as it's stale.
Sorry @berndporr, I couldn't try till today. Tested, all works now.