:: Re: [Libbitcoin] Libbitcoin and Qt
Top Page
Delete this message
Reply to this message
Author: Bedeho Mender
Date:  
To: Eric Voskuil
CC: libbitcoin@lists.dyne.org
Subject: Re: [Libbitcoin] Libbitcoin and Qt
Fantastic, that worked!

I am now able to build a project which includes libbitcoin headers!

I get a bunch of issues with linking when I actually try to use libbitcoin
functions, but I think I may be able to resolve those.

Thanks a lot Eric!

On 24 March 2015 at 10:17, Eric Voskuil <eric@???> wrote:

> This isn't a problem with cross-compiler linking (or a regression), it's
> simply the result of the fact that we don't yet have the exports/imports
> properly/fully defined for DLL linkage (not yet supported).
>
> The errors are the result of BC_API getting defined to
> __declspec(dllimport). You just need to define BC_STATIC. See define.hpp.
>
> e
>
> On 03/24/2015 01:16 AM, Eric Voskuil wrote:
> > Hi Bedeho,
> >
> > I suspect the errors are the result of a change I made today in master.
> > I'll look into it.
> >
> > The define warning pertains to your project. All libbitcoin VS. projects
> > declare Windows XP SP2 as the build target:
> >
> > _WIN32_WINNT=0x0600
> >
> > If you currently have no reason to do otherwise I'd recommend you do the
> > same in your project.
> >
> > e
> >
> > On 03/24/2015 12:01 AM, Bedeho Mender wrote:
> >> Hi Eric,
> >>
> >> Giving the new headers a try.
> >>
> >> As before, built libbitcoin with MSVC Nov 2013 CTP, and then I have an
> >> example Qt project which uses the vanilla MSVC2013.
> >>
> >> I get different build errors this time, and fewer of them. As one would
> >> expect, nothing related to constexpr.
> >>
> >> There are basically headers which cause problems, as seen by these
> errors
> >>
> >>
> C:\libbitcoin\libbitcoin\include\bitcoin/bitcoin/math/hash_number.hpp(74) :
> >> error C2375: 'libbitcoin::operator >' : redefinition; different linkage
> >>
> >>
> C:\libbitcoin\libbitcoin\include\bitcoin/bitcoin/math/hash_number.hpp(57) :
> >> see declaration of 'libbitcoin::operator >'
> >>
> >>
> C:\libbitcoin\libbitcoin\include\bitcoin/bitcoin/math/hash_number.hpp(76) :
> >> error C2375: 'libbitcoin::operator <=' : redefinition; different linkage
> >>
> >>
> C:\libbitcoin\libbitcoin\include\bitcoin/bitcoin/math/hash_number.hpp(59) :
> >> see declaration of 'libbitcoin::operator <='
> >>
> >>
> C:\libbitcoin\libbitcoin\include\bitcoin/bitcoin/math/hash_number.hpp(78) :
> >> error C2375: 'libbitcoin::operator <<' : redefinition; different linkage
> >>
> >>
> C:\libbitcoin\libbitcoin\include\bitcoin/bitcoin/math/hash_number.hpp(61) :
> >> see declaration of 'libbitcoin::operator <<'
> >>
> >>
> C:\libbitcoin\libbitcoin\include\bitcoin/bitcoin/math/hash_number.hpp(80) :
> >> error C2375: 'libbitcoin::operator /' : redefinition; different linkage
> >>
> >>
> C:\libbitcoin\libbitcoin\include\bitcoin/bitcoin/math/hash_number.hpp(63) :
> >> see declaration of 'libbitcoin::operator /'
> >>
> >>
> C:\libbitcoin\libbitcoin\include\bitcoin/bitcoin/math/hash_number.hpp(82) :
> >> error C2375: 'libbitcoin::operator +' : redefinition; different linkage
> >>
> >>
> C:\libbitcoin\libbitcoin\include\bitcoin/bitcoin/math/hash_number.hpp(65) :
> >> see declaration of 'libbitcoin::operator +'
> >>
> >>
> C:\libbitcoin\libbitcoin\include\bitcoin/bitcoin/math/hash_number.hpp(84) :
> >> error C2375: 'libbitcoin::operator ==' : redefinition; different linkage
> >>
> >>
> C:\libbitcoin\libbitcoin\include\bitcoin/bitcoin/math/hash_number.hpp(67) :
> >> see declaration of 'libbitcoin::operator =='
> >>
> >> Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. For example:
> >>
> >> - add -D_WIN32_WINNT=0x0501 to the compiler command line; or
> >>
> >> - add _WIN32_WINNT=0x0501 to your project's Preprocessor Definitions.
> >>
> >> Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target).
> >>
> >> C:\libbitcoin\libbitcoin\include\bitcoin/bitcoin/utility/binary.hpp(79)
> >> : error C2375: 'libbitcoin::operator ==' : redefinition; different
> linkage
> >>
> >> C:\libbitcoin\libbitcoin\include\bitcoin/bitcoin/utility/binary.hpp(64)
> >> : see declaration of 'libbitcoin::operator =='
> >>
> >> C:\libbitcoin\libbitcoin\include\bitcoin/bitcoin/utility/binary.hpp(84)
> >> : error C2375: 'libbitcoin::operator >>' : redefinition; different
> linkage
> >>
> >> C:\libbitcoin\libbitcoin\include\bitcoin/bitcoin/utility/binary.hpp(66)
> >> : see declaration of 'libbitcoin::operator >>'
> >>
> >> C:\libbitcoin\libbitcoin\include\bitcoin/bitcoin/utility/binary.hpp(86)
> >> : error C2375: 'libbitcoin::operator <<' : redefinition; different
> linkage
> >>
> >> C:\libbitcoin\libbitcoin\include\bitcoin/bitcoin/utility/binary.hpp(68)
> >> : see declaration of 'libbitcoin::operator <<'
> >>
> >> This is what I'm working with: https://github.com/bedeho/QtLibbitcoin
> >>
> >> best
> >> Bedeho
> >>
> >>
> >> On 23 March 2015 at 22:07, Eric Voskuil <eric@???
> >> <mailto:eric@voskuil.org>> wrote:
> >>
> >>     Regarding the /Zc:threadSafeInit option, this was added later, in
> the
> >>     June "VS14" CTP (now VS2015 in CTP 6), so I'm leaving it as-is.

> >>
> >>     e

> >>
> >>
> >>     On 03/23/2015 01:49 PM, Eric Voskuil wrote:
> >>     > I've updated all libbitcoin repos so that there is no code in
> >>     published
> >>     > headers requiring the VC++ CTP compiler (generally C++11 stuff,
> mostly
> >>     > constexpr).
> >>     >
> >>     > I've done the same in all test projects, which I've also changed
> >>     to not
> >>     > use the CTP compiler and instead use VC++12. This provides a
> >>     convenient
> >>     > means to ensure that the CTP requirement doesn't creep into the
> >>     headers
> >>     > or break in another manner. It also provides an example of how to
> link
> >>     > to the main libraries (built with the CTP compiler) using the RTM
> >>     compiler.

> >>     >
> >>     > There is a small additional runtime library that augments the CRT
> when
> >>     > linking with VC12. This is automatically incorporated, although I
> may
> >>     > try and get rid of that requirement by using "
> /Zc:threadSafeInit" as
> >>     > described here:

> >>     >

> >>     >

> >>
> http://blogs.msdn.com/b/vcblog/archive/2014/06/03/visual-studio-14-ctp.aspx
> >>     >
> >>     > The changes are accomplished using three new libbitcoin macros
> >>     > (BC_CONSTREXPR, BC_CONSTFUNC and BC_NOEXCEPT) so that non-MSVC
> builds
> >>     > are unaffected. These should be used in all published headers and
> >>     tests.

> >>     >
> >>     > e

> >>     >
> >>     > On 03/19/2015 02:39 PM, Eric Voskuil wrote:
> >>     >> It may not be too difficult to remove from headers. Templates may
> >>     >> present problems beyond the use of constexpr. I'd be happy to
> >>     review a
> >>     >> pull request.

> >>     >>
> >>     >> e

> >>     >>
> >>     >> On 03/19/2015 02:07 PM, Bedeho Mender wrote:
> >>     >>> Hi Eric,

> >>     >>>
> >>     >>> Ive been talking to some Qt developers, and it appears that you
> do
> >>     >>> indeed have to rebuild Qt with a newer MSVC version, however, it
> >>     turns
> >>     >>> out that this is likely not possible with the present build
> >>     system on
> >>     >>> Windows with these new versions of MSVC (for reasons was not
> given).

> >>     >>>
> >>     >>> How difficult would it be to have a version of libbitcoin where
> >>     the CTP
> >>     >>> 2013 features were taken out, so that libbitcoin could be used
> >>     with the
> >>     >>> latest full release of MSVC 2013? That is, how prevalent is the
> >>     usage of
> >>     >>> C++11 features which only are implemented in the CTP? e.g.
> >>     constexpr.

> >>     >>>
> >>     >>> I would be happy to sponsor this dev work depending on how
> >>     involved it
> >>     >>> would be, and that would allow people to use libbitcoin with Qt
> >>     -  which
> >>     >>> I think a lot of people will likely want to do, given that Qt
> is the
> >>     >>> most popular C++ framework out there.

> >>     >>>
> >>     >>> best
> >>     >>>  bedeho

> >>     >>>

> >>     >>>

> >>     >>>
> >>     >>> On 17 March 2015 at 20:52, Eric Voskuil <eric@???
> >>     <mailto:eric@voskuil.org>
> >>     >>> <mailto:eric@voskuil.org <mailto:eric@voskuil.org>>> wrote:

> >>     >>>
> >>     >>>     Ah yes, that's unfortunate. Now I remember I looked at QT a
> >>     while back
> >>     >>>     and determined I would need to compile QT to make it work. I
> >>     decided to
> >>     >>>     wait for time to resolve the issue :/

> >>     >>>
> >>     >>>     e

> >>     >>>
> >>     >>>     On 03/17/2015 06:27 AM, Bedeho Mender wrote:
> >>     >>>     > Hi Eric, thanks for the quick response!

> >>     >>>     >
> >>     >>>     > It doesn't appear so to me, but perhaps I am
> >>     misunderstanding the
> >>     >>>     problem.

> >>     >>>     >
> >>     >>>     > When I make a minimal Qt project
> >>     >>>     > (
> https://github.com/bedeho/QtLibbitcoin/blob/master/main.cpp)
> >>     >>>     which uses
> >>     >>>     > MSVC2013, then if I just
> >>     >>>     > include the libbitcoin header #include
> >>     <bitcoin/bitcoin.hpp>, then
> >>     >>>     I get
> >>     >>>     > lots of compile errors.

> >>     >>>     >
> >>     >>>     > The errors seem to be associated with certain c++11
> >>     features which
> >>     >>>     > msvc2013 does
> >>     >>>     > not support fully. Here is the first error I get

> >>     >>>     >

> >>     >>>     >
> >>     C:\libbitcoin\libbitcoin\include\bitcoin/bitcoin/math/hash.hpp(31) :
> >>     >>>     > error C2146: syntax error : missing ';' before identifier
> >>     'size_t'

> >>     >>>     >
> >>     >>>     > Which references line 31 in hash.hpp:

> >>     >>>     >
> >>     >>>     > constexpr size_t short_hash_size = 20;

> >>     >>>     >
> >>     >>>     > In this case, the problem seems to be that constexpr is a
> >>     new feature
> >>     >>>     > which msvc2013 does not support, from what I could
> >>     understand by
> >>     >>>     > reading up, and that CTP_Nov2013 was required for this
> >>     reason. For
> >>     >>>     > example, the release notes on this CTP explicitly mentions
> >>     constexpr
> >>     >>>     > support
> >>     >>>     (
> http://www.microsoft.com/en-us/download/details.aspx?id=41151):
> >>     >>>     > "constexpr (except for constructors)"

> >>     >>>     >
> >>     >>>     > Am I on the wrong track here? If not, getting Qt to work
> >>     with CTP
> >>     >>>     > is necessary to for using Libbitcon with Qt.

> >>     >>>     >
> >>     >>>     > bedeho

> >>     >>>     >

> >>     >>>     >
> >>     >>>     > On 16 March 2015 at 22:48, Eric Voskuil <eric@???
> >>     <mailto:eric@voskuil.org>
> >>     >>>     <mailto:eric@voskuil.org <mailto:eric@voskuil.org>>
> >>     >>>     > <mailto:eric@voskuil.org <mailto:eric@voskuil.org>
> >>     <mailto:eric@voskuil.org <mailto:eric@voskuil.org>>>> wrote:

> >>     >>>     >
> >>     >>>     >     You can link to the libbitcoin VC++ libs using the
> >>     basic v120
> >>     >>>     >     compiler, they are compatible.

> >>     >>>     >
> >>     >>>     >     e

> >>     >>>     >

> >>     >>>     >
> >>     >>>     >     > On Mar 16, 2015, at 8:58 AM, Bedeho Mender
> >>     >>>     >     <bedeho.mender@???
> >>     <mailto:bedeho.mender@gmail.com> <mailto:bedeho.mender@gmail.com
> >>     <mailto:bedeho.mender@gmail.com>>
> >>     >>>     <mailto:bedeho.mender@gmail.com
> >>     <mailto:bedeho.mender@gmail.com> <mailto:bedeho.mender@gmail.com
> >>     <mailto:bedeho.mender@gmail.com>>>>
> >>     >>>     wrote:

> >>     >>>     >     >
> >>     >>>     >     > I have built libbitcoin with msvc using the compiler
> >>     Microsoft
> >>     >>>     >     Visual C++ Compiler Nov 2013 CTP.

> >>     >>>     >     >
> >>     >>>     >     > I am trying to use libbitcoin with a Qt project
> >>     running in
> >>     >>>     >     QtCreator, however it seems this is not easy to do,
> >>     that is get Qt
> >>     >>>     >     to get with the CTP.

> >>     >>>     >     >
> >>     >>>     >     > Does anyone have any advice on this?

> >>     >>>     >     >
> >>     >>>     >     > best
> >>     >>>     >     >  Bedeho

> >>     >>>

> >>     >>>

> >>     >>

> >>     >

> >>
> >>
> >>     _______________________________________________
> >>     Libbitcoin mailing list
> >>     Libbitcoin@??? <mailto:Libbitcoin@lists.dyne.org>
> >>     https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/libbitcoin

> >>
> >>
> >
>
>