For your 2012 error: Don't build the concurrency/boost*.cpp files on
MSVC2012. MSVC2012 prefers using std::thread to boost::thread.
For your 2010 error: That is a result of including <sys/param.h> within
namespace apache::thrift::protocol {}. This issue has been fixed in
"master", but isn't in an official release yet. You can replicate the fix
in protocol/TProtocol.h.
I'm not entirely sure what the issue is on the pollfd side of things.
WinXP targeting is the default, and I don't have any more immediate
answers for you there.
Žygimantas Butkus <[email protected]> wrote on 03/17/2014 11:42:33 AM:
> From: Žygimantas Butkus <[email protected]>
> To: [email protected],
> Date: 03/17/2014 11:43 AM
> Subject: Re: Compiling 0.9.1 under Windows
>
> Hello Lars and Ben,
>
> From QT side, yes, i think i need to build thrift libs on Visual Studio
and
> then use them in QT. However, I can't do that.
> If I try to build libthrift library without commenting any line of code,
I
> get the following error (MVSC 2012):
>
> 1>------ Build started: Project: libthrift, Configuration: Debug Win32
> ------
> 1> BoostThreadFactory.cpp
> 1>c:\users\buzzy\desktop\thrift2012\thrift-0.9.1\lib\cpp\src\thrift
> \concurrency\boostthreadfactory.cpp(101):
> error C2664: 'std::thread::id::id(const std::thread &)' : cannot convert
> parameter 1 from 'boost::thread::id' to 'const std::thread &'
> 1> Reason: cannot convert from 'boost::thread::id' to 'const
> std::thread'
> 1> No user-defined-conversion operator available that can
perform
> this conversion, or the operator cannot be called
> 1>c:\users\buzzy\desktop\thrift2012\thrift-0.9.1\lib\cpp\src\thrift
> \concurrency\boostthreadfactory.cpp(165):
> error C2664: 'std::thread::id::id(const std::thread &)' : cannot convert
> parameter 1 from 'boost::thread::id' to 'const std::thread &'
> 1> Reason: cannot convert from 'boost::thread::id' to 'const
> std::thread'
> 1> No user-defined-conversion operator available that can
perform
> this conversion, or the operator cannot be called
> ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
==========
>
> If I compile this on MVSC 2010, I get this:
>
> 1>------ Build started: Project: libthrift, Configuration: Debug Win32
> ------
> 1> PeekProcessor.cpp
>
1>c:\users\buzzy\desktop\boost_1_55_0\boost\smart_ptr\intrusive_ptr.hpp(162):
> error C2668: '_wassert' : ambiguous call to overloaded function
> 1> e:\program files (x86)\microsoft visual studio
> 10.0\vc\include\assert.h(28): could be 'void _wassert(const wchar_t
*,const
> wchar_t *,unsigned int)'
> 1> e:\program files (x86)\microsoft visual studio
> 10.0\vc\include\assert.h(28): or 'void
> apache::thrift::protocol::_wassert(const wchar_t *,const wchar_t
*,unsigned
> int)'
> 1> while trying to match the argument list '(const wchar_t [8],
> const wchar_t [70], int)'
> 1>
>
c:\users\buzzy\desktop\boost_1_55_0\boost\smart_ptr\intrusive_ptr.hpp(161)
> : while compiling class template member function
> 'boost::detail::basic_cv_list_entry *boost::intrusive_ptr<T>::operator
> ->(void) const'
> 1> with
> 1> [
> 1> T=boost::detail::basic_cv_list_entry
> 1> ]
> 1>
> c:\users\buzzy\desktop\boost_1_55_0\boost\thread\win32
> \condition_variable.hpp(63)
> : see reference to class template instantiation
'boost::intrusive_ptr<T>'
> being compiled
> 1> with
> 1> [
> 1> T=boost::detail::basic_cv_list_entry
> 1> ]
> ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
==========
>
> If I change WINVER to 0x0600, I get (MVSC 2010 and 2012):
>
> 1>------ Build started: Project: libthrift, Configuration: Debug Win32
> ------
> 1> WinFcntl.cpp
> 1> TWinsockSingleton.cpp
> 1>c:\users\buzzy\desktop\thrift2012\thrift-0.9.1\lib\cpp\src\thrift
> \windows\winfcntl.h(45):
> error C2065: 'pollfd' : undeclared identifier
> 1>c:\users\buzzy\desktop\thrift2012\thrift-0.9.1\lib\cpp\src\thrift
> \windows\winfcntl.h(45):
> error C2065: 'fdArray' : undeclared identifier
> 1>c:\users\buzzy\desktop\thrift2012\thrift-0.9.1\lib\cpp\src\thrift
> \windows\winfcntl.h(45):
> error C2275: 'ULONG' : illegal use of this type as an expression
> 1> c:\program files (x86)\windows
> kits\8.0\include\shared\minwindef.h(51) : see declaration of 'ULONG'
> 1>c:\users\buzzy\desktop\thrift2012\thrift-0.9.1\lib\cpp\src\thrift
> \windows\winfcntl.h(45):
> error C2146: syntax error : missing ')' before identifier 'nfds'
> 1>c:\users\buzzy\desktop\thrift2012\thrift-0.9.1\lib\cpp\src\thrift
> \windows\winfcntl.h(45):
> error C2078: too many initializers
> 1> c:\program files (x86)\windows
> kits\8.0\include\shared\minwindef.h(51) : see declaration of 'ULONG'
> 1>c:\users\buzzy\desktop\thrift2012\thrift-0.9.1\lib\cpp\src\thrift
> \windows\winfcntl.h(45):
> error C2059: syntax error : ')'
> 1> SocketPair.cpp
> 1>A task was canceled.
> Build has been canceled.
>
> Maybe I'm somehow linking to boost libs badly? I'm doing it this way:
> Properties>Configuration Properties>Librarian>Additional Library
> Directories>C:\.......\boost_1_55_0\stage\lib
>
>
>
> On Mon, Mar 17, 2014 at 10:47 AM, Lars Benner <[email protected]> wrote:
>
> > Hi Žygimantas,
> >
> > From what I can tell, the mingw part is missing a reference to the
Thrift
> > libs.
> >
> > Is the Visual Studio variant compiling, with TARGET_WIN_XP not
commented
> > out?
> >
> > - Lars
> >
> >
> > -----Original Message-----
> > From: Žygimantas Butkus [mailto:[email protected]]
> > Sent: Sunday, March 16, 2014 7:21 PM
> > To: [email protected]
> > Subject: Compiling 0.9.1 under Windows
> >
> > Hello,
> > I'm trying to build a Thrift library on Windows for past two days...
My
> > project works great on Linux platform and now I want to port cpp
client
> > side to Windows. I'm using QT.
> > At the moment QT with mingw compiler gives me following error in
> > gen-cpp/serv.cpp file(thrift source files included as path):
> >
> > 19:52:33: Running steps for project GUI...
> >
> > 19:52:33: Configuration unchanged, skipping qmake step.
> >
> > 19:52:33: Starting: "E:\Qt\Tools\mingw48_32\bin\mingw32-make.exe"
> >
> > E:/Qt/Tools/mingw48_32/bin/mingw32-make -f Makefile.Release
> >
> > mingw32-make[1]: Entering directory
> >
> > 'C:/Users/buzzy/Desktop/television-4e17a407ed01/build-GUI-
> Desktop_Qt_5_2_1_MinGW_32bit-Release'
> >
> > g++ -Wl,-s -Wl,-subsystem,windows -mthreads -o release\GUI.exe
> > object_scriptGUI.Release -lglu32 -lopengl32 -lgdi32 -luser32 -lmingw32
> > -lqtmain -LC:/Users/buzzy/Desktop/boost_1_55_0/stage/lib/
> > -llibboost_filesystem-vc110-mt-1_55 -llibboost_system-vc110-mt-1_55
> > -llibboost_thread-vc110-mt-1_55 -LE:\Qt\5.2.1\mingw48_32\lib
-lQt5Widgets
> > -lQt5Network -lQt5Gui -lQt5Core
> >
> > ./release\serv.o:serv.cpp:(.text+0x74b): undefined reference to
> >
> > `apache::thrift::TApplicationException::write
> (apache::thrift::protocol::TProtocol*)
> > const'
> >
> > ./release\serv.o:serv.cpp:(.text+0x1356): undefined reference to
> >
> > `apache::thrift::TApplicationException::write
> (apache::thrift::protocol::TProtocol*)
> > const'
> >
> > ./release\serv.o:serv.cpp:(.text+0x4281): undefined reference to
> >
> > `apache::thrift::TApplicationException::write
> (apache::thrift::protocol::TProtocol*)
> > const'
> >
> > Makefile.Release:178: recipe for target 'release\GUI.exe' failed
> >
> > ./release\serv.o:serv.cpp:(.text+0x4e75): undefined reference to
> >
> > `apache::thrift::TApplicationException::write
> (apache::thrift::protocol::TProtocol*)
> > const'
> >
> > ...
> >
> >
> > What can be wrong here?
> > Also I'm trying to build MV2010 project included in 0.9.1 ver. And if
I
> > comment out the "# define TARGET_WIN_XP 1" part, I'm getting these
> > errors(boost source included in path):
> >
> > 1> TWinsockSingleton.cpp
> >
> > 1>c:\users\buzzy\desktop\thrift2\thrift-0.9.1\lib\cpp\src\thrift
> \windows\winfcntl.h(45):
> > error C2065: 'thrift_pollfd' : undeclared identifier
> >
> > 1>c:\users\buzzy\desktop\thrift2\thrift-0.9.1\lib\cpp\src\thrift
> \windows\winfcntl.h(45):
> > error C2065: 'fdArray' : undeclared identifier
> >
> > 1>c:\users\buzzy\desktop\thrift2\thrift-0.9.1\lib\cpp\src\thrift
> \windows\winfcntl.h(45):
> > error C2275: 'ULONG' : illegal use of this type as an expression
> > 1> c:\program files (x86)\microsoft
> > sdks\windows\v7.0a\include\windef.h(48) : see declaration of 'ULONG'
> >
> > 1>c:\users\buzzy\desktop\thrift2\thrift-0.9.1\lib\cpp\src\thrift
> \windows\winfcntl.h(45):
> > error C2146: syntax error : missing ')' before identifier 'nfds'
> >
> > 1>c:\users\buzzy\desktop\thrift2\thrift-0.9.1\lib\cpp\src\thrift
> \windows\winfcntl.h(45):
> > error C2078: too many initializers
> >
> > 1>c:\users\buzzy\desktop\thrift2\thrift-0.9.1\lib\cpp\src\thrift
> \windows\winfcntl.h(45):
> > error C2275: 'ULONG' : illegal use of this type as an expression
> > 1> c:\program files (x86)\microsoft
> > sdks\windows\v7.0a\include\windef.h(48) : see declaration of 'ULONG'
> >
> > 1>c:\users\buzzy\desktop\thrift2\thrift-0.9.1\lib\cpp\src\thrift
> \windows\winfcntl.h(45):
> > error C2059: syntax error : ')'
> > 1> SocketPair.cpp
> > ....
> >
> > Could someone help me here, I'm completely lost. Thank you.
> >