Date: Sun, 6 Jan 2002 05:00:07 -0800 (PST) From: Bruce Evans <bde@zeta.org.au> To: freebsd-bugs@FreeBSD.org Subject: Re: misc/33590: imaxabs(3), imaxdiv(3) does not work with C++ linkage Message-ID: <200201061300.g06D07T08226@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR misc/33590; it has been noted by GNATS. From: Bruce Evans <bde@zeta.org.au> To: Vladimir Kushnir <vkushnir@Alfacom.net>, <mike@freebsd.org> Cc: <freebsd-gnats-submit@freebsd.org> Subject: Re: misc/33590: imaxabs(3), imaxdiv(3) does not work with C++ linkage Date: Sun, 6 Jan 2002 23:55:14 +1100 (EST) On Sat, 5 Jan 2002, Vladimir Kushnir wrote: > >Description: > Libc functions imaxabs(3), imaxdiv(3) used in C++ programs lead to "undefined > reference" errors. > >How-To-Repeat: > Compile as C++ this code: > /* test.cc */ > #include <inttypes.h> > > main() { > intmax_t a = 1; > intmax_t b; > imaxdiv_t c; > b = imaxabs(a); > c = imaxdiv(a, b); > } > > Output: > ~> c++ -o itest test.cc > /tmp/ccplyujk.o: In function `main': > /tmp/ccplyujk.o(.text+0x21): undefined reference to `imaxabs(long long)' > /tmp/ccplyujk.o(.text+0x4e): undefined reference to `imaxdiv(long long, long long)' > > > >Fix: %%% Index: inttypes.h =================================================================== RCS file: /home/ncvs/src/include/inttypes.h,v retrieving revision 1.2 diff -u -2 -r1.2 inttypes.h --- inttypes.h 15 Nov 2001 02:05:03 -0000 1.2 +++ inttypes.h 6 Jan 2002 12:51:47 -0000 @@ -43,4 +43,5 @@ } imaxdiv_t; +__BEGIN_DECLS intmax_t imaxabs(intmax_t) __pure2; imaxdiv_t imaxdiv(intmax_t, intmax_t) __pure2; @@ -51,4 +52,5 @@ intmax_t wcstoimax(const wchar_t *, wchar_t **, int); uintmax_t wcstoumax(const wchar_t *, wchar_t **, int); +__END_DECLS #endif /* !_INTTYPES_H_ */ %%% Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200201061300.g06D07T08226>