This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: undefined reference to libquadmath routines
- From: Ian Lance Taylor <iant at google dot com>
- To: Syed Bilal Mehdi <bilal dot mehdi87 at gmail dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Tue, 07 Jun 2011 06:31:22 -0700
- Subject: Re: undefined reference to libquadmath routines
- References: <31790381.post@talk.nabble.com>
Syed Bilal Mehdi <bilal.mehdi87@gmail.com> writes:
> /site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:13:
> undefined reference to `sqrtq(__float128)'
> /site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:14:
> undefined reference to `quadmath_snprintf(char*, unsigned int, char const*,
> ...)'
> /site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:18:
> undefined reference to `quadmath_snprintf(char*, unsigned int, char const*,
> ...)'
> /site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:22:
> undefined reference to `quadmath_snprintf(char*, unsigned int, char const*,
> ...)'
> /site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:28:
> undefined reference to `quadmath_snprintf(char*, unsigned int, char const*,
> ...)'
> /site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:18:
> undefined reference to `quadmath_snprintf(char*, unsigned int, char const*,
> ...)'
>
> What am I missing here. I tried specifying -lquadmath but that didn't help!!
The format of those errors tells me that you are calling these as C++
functions, but they are written in C. There is a missing extern "C"
somewhere.
In fact, it's in quadmath.h. That's a bug. Please file a bug report
for it. Thanks.
In the meantime, write this:
extern "C" {
#include "quadmath.h"
}
Ian