[
https://issues.apache.org/jira/browse/THRIFT-3810?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15367869#comment-15367869
]
James E. King, III commented on THRIFT-3810:
--------------------------------------------
Using cmake I was able to build libthrift containing the symbol you mentioned.
Here is what I did with Visual Studio 2010:
# Installed cmake (3.6)
# Downloaded WinFlexBison
# Downloaded and built Boost 1.58
# Downloaded and built zlib-1.2.5
# Pulled down thrift origin/master
# Created a batch file to set up the build - this is placed next to the
"thrift" directory and makes an out-of-tree build directory called thrift-build:
{code}
mkdir thrift-build
cd thrift-build
"C:\Program Files\CMake\bin\cmake.exe" ..\thrift -G"NMake Makefiles"
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_SHARED_LIB=OFF -DWITH_STATIC_LIB=ON
-DWITH_BOOSTTHREADS=ON -DBOOST_ROOT=C:\Users\Jim\workspace\boost_1_58_0
-DBOOST_LIBRARYDIR=C:\Users\Jim\workspace\boost_1_58_0\stage\lib
-DZLIB_ROOT=C:\Users\Jim\workspace\zlib-1.2.5
-DOPENSSL_ROOT_DIR=C:\Users\Jim\workspace\openssl-1.0.1m
-DFLEX_EXECUTABLE=C:\Users\Jim\workspace\winflexbison\win_flex.exe
-DBISON_EXECUTABLE=C:\Users\Jim\workspace\winflexbison\win_bison.exe
REM -G"NMake Makefiles" -G"Visual Studio 10 Win64"
REM -DLIBEVENT_ROOT=C:\Users\Jim\workspace\libevent
{code}
# Finally, ``nmake /f Makefile`` builds it, and I see:
{code}
[ 39%] Building CXX object
lib/cpp/CMakeFiles/thrift_static.dir/src/thrift/server/TConnectedClient.cpp.obj
TConnectedClient.cpp
[ 39%] Building CXX object
lib/cpp/CMakeFiles/thrift_static.dir/src/thrift/server/TServerFramework.cpp.obj
TServerFramework.cpp
[ 40%] Building CXX object
lib/cpp/CMakeFiles/thrift_static.dir/src/thrift/server/TSimpleServer.cpp.obj
TSimpleServer.cpp
[ 41%] Building CXX object
lib/cpp/CMakeFiles/thrift_static.dir/src/thrift/server/TThreadPoolServer.cpp.obj
{code}
> unresolved external symbol "public: virtual void __cdecl
> apache::thrift::server::TServerFramework::serve(void)"
> (?serve@TServerFramework@server@thrift@apache@@UEAAXXZ)
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: THRIFT-3810
> URL: https://issues.apache.org/jira/browse/THRIFT-3810
> Project: Thrift
> Issue Type: Bug
> Components: C++ - Library
> Affects Versions: 0.9.3
> Environment: Virtual studio 2013 and windows 7
> Reporter: zengraoli
> Assignee: James E. King, III
>
> {color:red}
> $. add TestServer.thrift
> {color}
> {code}
> namespace cpp zam.thrift.test
> namespace py thriftTest
> namespace java com.zam.thrift.test
> namespace php thriftTest
> service Hello {
> string helloString(1:string word)
> }
> {code}
> {color:red}
> $. compile TestServer.thrift
> {color}
> {code}
> thrift --strict --gen cpp --out . TestServer.thrift
> {code}
> {color:red}
> $. copy build c++ code in Visual Studio and run, tips unresolved external
> symbol :
> {color}
> {code}
> "public: virtual void __cdecl
> apache::thrift::server::TServerFramework::serve(void)"
> (?serve@TServerFramework@server@thrift@apache@@UEAAXXZ)
> "public: virtual void __cdecl
> apache::thrift::server::TServerFramework::serve(void)"
> (?serve@TServerFramework@server@thrift@apache@@UEAAXXZ)
> "public: __cdecl
> apache::thrift::server::TServerFramework::TServerFramework(class
> boost::shared_ptr<class apache::thrift::TProcessorFactory> const &,class
> boost::shared_ptr<class apache::thrift::transport::TServerTransport> const
> &,class boost::shared_ptr<class apache::thrift::transport::TTransportFactory>
> const &,class boost::shared_ptr<class
> apache::thrift::protocol::TProtocolFactory> const &)"
> (??0TServerFramework@server@thrift@apache@@QEAA@AEBV?$shared_ptr@VTProcessorFactory@thrift@apache@@@boost@@AEBV?$shared_ptr@VTServerTransport@transport@thrift@apache@@@5@AEBV?$shared_ptr@VTTransportFactory@transport@thrift@apache@@@5@AEBV?$shared_ptr@VTProtocolFactory@protocol@thrift@apache@@@5@@Z),该符号在函数
> "public: __cdecl apache::thrift::server::TSimpleServer::TSimpleServer(class
> boost::shared_ptr<class apache::thrift::TProcessorFactory> const &,class
> boost::shared_ptr<class apache::thrift::transport::TServerTransport> const
> &,class boost::shared_ptr<class apache::thrift::transport::TTransportFactory>
> const &,class boost::shared_ptr<class
> apache::thrift::protocol::TProtocolFactory> const &)"
> (??0TSimpleServer@server@thrift@apache@@QEAA@AEBV?$shared_ptr@VTProcessorFactory@thrift@apache@@@boost@@AEBV?$shared_ptr@VTServerTransport@transport@thrift@apache@@@5@AEBV?$shared_ptr@VTTransportFactory@transport@thrift@apache@@@5@AEBV?$shared_ptr@VTProtocolFactory@protocol@thrift@apache@@@5@@Z)
> {code}
> {color:red}
> $.why error is occur of TServerFramework file?
> {color}
> {color:red}
> $.main code:
> {color}
> {code}
> #include "hello.h"
> #include <Thrift.h>
> #include <thrift/Thrift.h>
> #include <thrift/protocol/TBinaryProtocol.h>
> #include <thrift/server/TSimpleServer.h>
> #include <thrift/transport/TServerSocket.h>
> #include <thrift/transport/TBufferTransports.h>
> #pragma comment(lib, "libthrift.lib")
> #pragma comment(lib, "libeay32.lib")
> #pragma comment(lib, "ssleay32.lib")
> using namespace ::apache::thrift;
> using namespace ::apache::thrift::protocol;
> using namespace ::apache::thrift::transport;
> using namespace ::apache::thrift::server;
> using boost::shared_ptr;
> class helloHandler : virtual public helloIf {
> public:
> helloHandler() {
> // Your initialization goes here
> }
> void func1() {
> // Your implementation goes here
> printf("Hello Thrift\n");
> }
> };
> int main(int argc, char **argv) {
> WORD wVersionRequested;
> WSADATA wsaData;
> int err;
> wVersionRequested = MAKEWORD(2, 2);
> err = WSAStartup(wVersionRequested, &wsaData);
> int port = 9090;
> shared_ptr<helloHandler> handler(new helloHandler());
> shared_ptr<TProcessor> processor(new helloProcessor(handler));
> shared_ptr<TServerTransport> serverTransport(new TServerSocket(port));
> shared_ptr<TTransportFactory> transportFactory(new
> TBufferedTransportFactory());
> shared_ptr<TProtocolFactory> protocolFactory(new
> TBinaryProtocolFactory());
> TSimpleServer server(processor, serverTransport, transportFactory,
> protocolFactory);
> server.serve();
> return 0;
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)