Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why do I get the following warning from the linker: “ld: warning: symbol clog has differing types”?

0
Posted

Why do I get the following warning from the linker: “ld: warning: symbol clog has differing types”?

0

The linker warns about the pair of weak symbols that have different types when you link libm.so.2 and the classic iostream library in the same program. You can ignore the warning. The default math library on Solaris 10 is libm.so.2 and it contains the complex log function ‘clog’ in the global namespace as required by the C99 standard. If you use C++ classic iostreams by specifying -compat=4 or by specifying -library=iostream, you get the buffered standard error stream ‘clog’ in the global namespace. (Standard iostreams does not have this conflicting symbol.) We have adjusted headers and libraries to silently rename each of these ‘clog’ symbols so that you can use both in one program. However, we must retain the original symbol spellings as weak symbols in each of the libraries, so that old binaries looking for the original symbols can continue to link. Be sure to get iostream and math declarations by including the appropriate system headers rather than declaring any of these entities y

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123