| GCC Reports Errors With C++ Using Math.h Functions (3.1.8) | pikpik | 10/29/10 1:09 PM | Hi,
In MINIX 3.1.8, using GCC 4.4.3, I tried to compile the following C++ file and received errors. Contents of "math.cpp": #include <iostream> #include "math.h" int main () { double number = 0.0 / 0.0; if ( isnan ( number ) ) { std::cout << "Is a number." << std::endl; } else { std::cout << "Is not a number." << std::endl; } } Transcript of compilation attempt: # g++ -Wall -o math.output -c math.cpp math.cpp: In function 'int main()': math.cpp:8: error: 'isnan' was not declared in this scope This appears to be related to the "math.h" header file. I've noticed several things including the fact that MINIX's port of GCC changed some between MINIX releases 3.1.7 and 3.1.8 and that C++ this problem did not appear in the experimental release of 3.1.8 but only in the final release of 3.1.8. Thank you, pikpik |
| Re: [minix3] GCC Reports Errors With C++ Using Math.h Functions (3.1.8) | Alexander A. Gorodnev | 10/30/10 1:39 AM | Hi, Could you test the next fixes in your program? #include <iostream> int main () { double number = 0.0 / 0.0; if ( std::isnan ( number ) ) {
} Thanks, 2010/10/30 pikpik <pikpi...@gmail.com>:> -- |
| Re: GCC Reports Errors With C++ Using Math.h Functions (3.1.8) | pikpik | 10/30/10 9:43 AM | Hi,
On Oct 30, 4:39 am, "Alexander A. Gorodnev" <a.gorod...@gmail.com> wrote: > Hi,Gladly! Here are the results: math.cpp:8: 'isnan' is not a member of 'std' To me, it looks like "isnan" either is not available or is not in the proper name-space. Just to make sure GCC (G++) had everything available, I redid "make gnu-includes gnu-libraries" in "/usr/src." However, it didn't seem to have any effect. Thank you, pikpik |
| Re: GCC Reports Errors With C++ Using Math.h Functions (3.1.8) | pikpik | 11/3/10 12:02 PM | Hi,
I'm happy to say that, with a small change to "math.h," I'm now able to use "isnan" (and related functions) from "math.h" in C++! The change might not be very correct, but it appears to be functional: with it in place, the dependent parts of Google's V8 JavaScript Engine now compile successfully. Here's the change, inside "/usr/include/math.h" and "/usr/pkg/gcc44/ lib/gcc/i686-pc-minix/4.4.3/include-fixed/math.h": [...hypot and others...] Line 55: #if defined(_POSIX_SOURCE) /* STD-C? */ || \ Line 56: defined(__cplusplus) [...isnan and others...] This appears to work for me. pikpik |