Compiling under Win32 - isFinite() problem
Hello,
I'm trying to integrate bezier-utils.cpp into our own GPL software, and integrated necessary headers (from src/ and src/libnr/ especially). So in essence I'm not compiling Inkscape itself, but it's obvious that I would get the same problem if I tried to because the bug has no dependance.
Using the 'isFinite' macro doesn't work.
Source used: inkscape-0.42.tar.gz System: Win32 (Windows XP) Compiler: Microsoft Visual C++ .NET 7.1.3088
Compiler Log:
Compiling... bezier-utils.cpp bezier-utils.cpp(598) : error C2039: 'isfinite' : is not a member of 'std' bezier-utils.cpp(598) : error C3861: 'isfinite': identifier not found, even with argument-dependent lookup [...]
The lines with error uses macro 'isFinite'
Macro 'isFinite' is defined in 'isnan.h'
#if defined(__APPLE__) || defined(__isfinite) # define isFinite(_a) (__isfinite(_a)) /* MacOSX/Darwin definition */ #elif defined(isfinite) # define isFinite(_a) (isfinite(_a)) #else # define isFinite(_a) (std::isfinite(_a)) #endif
The last one gets used under my build environment.
Looking at mailing list archives, this seems to be a recurring problem, or at least it has been mentionned several times already.
At suggested in 'isnan.h', this works:
# define isFinite(_a) (!isNaN((_a) - (_a)))
Full block, patched:
#if defined(__APPLE__) || defined(__isfinite) # define isFinite(_a) (__isfinite(_a)) /* MacOSX/Darwin definition */ #elif defined(isfinite) # define isFinite(_a) (isfinite(_a)) #elif defined (WIN32) # define isFinite(_a) (!isNaN((_a) - (_a))) #else # define isFinite(_a) (std::isfinite(_a)) #endif
Not sure if it is the best solution. A specialized isfinite() could possibly be faster but I can't find an implementation on my system.
I'm wondering how the official Win32 EXE are getting compiled and if different distributions of MS Visual C++ librairies have some effect on this (probably), so don't take the above patch as taken. In any case, source code from Inkscape 0.42 doesn't work here so it should be worth discussing/fixing it.
Thank you all, Inkscape is excellent piece of software.
Omar Cornut
participants (1)
-
Omar Cornut