sba1 / adtools

Experimental GNU toolchain for AmigaOS
33 stars 18 forks source link

error: ‘trunc’ is not a member of ‘std’ #86

Open ksdhans opened 4 years ago

ksdhans commented 4 years ago

Attempting to use std::trunc() results in: error: ‘trunc’ is not a member of ‘std’

According to the C++11 spec, it should be set in cmath. I tried defining _GLIBCXX_USE_C99_MATH_TR1 in config++.h, but that resulted in a heap of errors such as: error: ‘::acoshl’ has not been declared

Acoshl and the others are missing from newlib (haven't checked clib2). They're part of the C99 spec.

sba1 commented 4 years ago

Generally, it would help a lot if for all known problems, a simple test source code is provided that can be added in the test folder, even if the problem looks simple.

ksdhans commented 4 years ago

Sure:

`#include

int main(int argc, const char **argv) { double valF = 2.4; int val = std::trunc(valF); printf("valF: %f, trunc(valF) = %d\n", valF, val); return 0; }`

This is part of the C++11 standard, so you'll need to set --std=c++11 or similar.

kas1e commented 3 years ago

from newlib's side everything about "not a member of std::" was fixed in the new beta of newlib 53.69 and adtools recompiled with new newlib's headers.