I have a complex double array eigenvalues
of which I want to get the natural logarithm of each entry by using clog
.
for (int i = 0; i < n; ++i)
{
qq[i] = clog(eigenvalues[i]);
}
I already dropped the using namespace std;
but am still getting error: reference to 'clog' is ambiguous
.
How can I make it clear that I want to use the clog
from complex.h
and not from iostream
?
I haven't been able to reproduce this with gcc 7.3 without using namespace std
but in general all functions from C headers reside in the global namespace. Therefore you should be able to resolve the ambiguity by prefixing clog with ::
:
for (int i = 0; i < n; ++i)
{
qq[i] = ::clog(eigenvalues[i]);
}