adtools icon indicating copy to clipboard operation
adtools copied to clipboard

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

Open ksdhans opened this issue 5 years ago • 3 comments

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.

ksdhans avatar May 15 '20 06:05 ksdhans

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.

sba1 avatar May 23 '20 15:05 sba1

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.

ksdhans avatar May 25 '20 06:05 ksdhans

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.

kas1e avatar Feb 02 '21 06:02 kas1e