Groups | Search | Server Info | Login | Register
Groups > comp.databases.berkeley-db > #8
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nx01.iad01.newshosting.com!newshosting.com!69.16.185.21.MISMATCH!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!h3g2000yqa.googlegroups.com!not-for-mail |
|---|---|
| From | ImpalerCore <jadill33@gmail.com> |
| Newsgroups | comp.databases.berkeley-db, comp.lang.c |
| Subject | Re: error: conflicting declaration 'typedef int32_t ssize_t' (mingw versus berkeley db) |
| Date | Tue, 29 Nov 2011 13:07:16 -0800 (PST) |
| Organization | http://groups.google.com |
| Lines | 68 |
| Message-ID | <1ab8e3c3-8b36-4523-a79f-c5cfb61c82c5@h3g2000yqa.googlegroups.com> (permalink) |
| References | <3e9fb$4ed19745$5419acc3$27249@cache1.tilbu1.nb.home.nl> |
| NNTP-Posting-Host | 160.107.87.10 |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | quoted-printable |
| X-Trace | posting.google.com 1322600837 8684 127.0.0.1 (29 Nov 2011 21:07:17 GMT) |
| X-Complaints-To | groups-abuse@google.com |
| NNTP-Posting-Date | Tue, 29 Nov 2011 21:07:17 +0000 (UTC) |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | h3g2000yqa.googlegroups.com; posting-host=160.107.87.10; posting-account=rH_E3woAAADR_9M5Q9bWAyDPjAMcf7LJ |
| User-Agent | G2/1.0 |
| X-Google-Web-Client | true |
| X-Google-Header-Order | HUALESRCNK |
| X-HTTP-UserAgent | Mozilla/5.0 (Windows NT 5.1; rv:8.0) Gecko/20100101 Firefox/8.0,gzip(gfe) |
| Xref | x330-a1.tempe.blueboxinc.net comp.databases.berkeley-db:8 comp.lang.c:14053 |
Cross-posted to 2 groups.
Show key headers only | View raw
On Nov 26, 8:50 pm, "Skybuck Flying" <Windows7I...@DreamPC2006.com>
wrote:
> Hello,
>
> Building the bitcoin-qt 0.5.0rc7 client for win32 (on windows 7) has a
> little problem, qtcreator reports a conflicting type "ssize_t".
>
> So two simple questions I guess:
>
> 1. How many bits should ssize_t be for mingw32 (types.h) ?
> 2. How many bits should ssize_t be for berkeley db (db.h) ?
The number of bits for 'ssize_t' should be the same number of bits of
'size_t'.
> And finally:
>
> 3. What would be a good solution to fix it ? (I could rename the type in
> db.h and modify all source code of berkeley db, but maybe there is an easier
> way ? Also I am not sure if renaming the type would help, since maybe there
> is a size conflict as well, hence questions 1 and 2 to be sure... )
One option would be to rely on the detection of a <sys/types.h> file,
a la autoconf and friends.
\code
#if defined(HAVE_SYS_TYPES_H)
/* Let's MinGW or other native OS define 'ssize_t' for you */
# include <sys/types.h>
#else
... Define ssize_t in your own way ...
#endif
\endcode
where '... Define ssize_t in your own way ...' could be
\code snippet db.h
#ifdef _WIN64
typedef int64_t ssize_t;
#else
typedef int32_t ssize_t;
#endif
\endcode
This would require you to manually define -DHAVE_SYS_TYPES_H in the
configuration if the build environment doesn't support run-time
detection of compiler and library features (like whether you can
include <sys/types.h>).
Ideally, defining a proper 'ssize_t' type should also include an
appropriate limit along the lines of 'SSIZE_MAX'. Another option is
to inspect whether the 'SSIZE_MAX' symbol is defined is use that
information to infer whether 'ssize_t' is defined as well. MinGW
defines one in its <limits.h>. YMMV
You can insert a compile-time assertion to verify that "sizeof
(size_t) == sizeof (ssize_t)" if you want to be sure.
#define C_STATIC_ASSERT(name, expr) extern char (name)[(expr) ? 1 :
-1]
C_STATIC_ASSERT( ssize_t_is_compatible_with_size_t,
sizeof (ssize_t) == sizeof (size_t) );
Best regards,
John D.
Back to comp.databases.berkeley-db | Previous | Next — Previous in thread | Find similar
error: conflicting declaration 'typedef int32_t ssize_t' (mingw versus berkeley db) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-11-27 02:50 +0100
Re: error: conflicting declaration 'typedef int32_t ssize_t' (mingw versus berkeley db) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-11-27 03:04 +0100
Re: error: conflicting declaration 'typedef int32_t ssize_t' (mingw versus berkeley db) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-11-27 03:27 +0100
Re: error: conflicting declaration 'typedef int32_t ssize_t' (mingw versus berkeley db) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-11-27 04:01 +0100
Re: error: conflicting declaration 'typedef int32_t ssize_t' (mingw versus berkeley db) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-11-27 19:42 +0100
Re: error: conflicting declaration 'typedef int32_t ssize_t' (mingw versus berkeley db) ImpalerCore <jadill33@gmail.com> - 2011-11-29 13:07 -0800
csiph-web