我试图获得一个大数字的日志。我该怎么做?我不能使用 gmp.hpp 因为它说Cannot open include file: 'gmp.h': No such file or directory
以下代码
#include <iostream>
#include <boost/multiprecision/cpp_int.hpp>
#define rsa100 "1522605027922533360535618378132637429718068114961380688657908494580122963258952897654000350692006139"
using namespace std;
using namespace boost::multiprecision;
int main(){
cpp_int n(rsa100);
cout << boost::multiprecision::log(n);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
给我错误:
1>------ Build started: Project: rsa, Configuration: Debug x64 ------
1> Source.cpp
1>Source.cpp(12): error C2893: Failed to specialize function template 'enable_if_c<boost::multiprecision::number_category<Num>::value==1,boost::multiprecision::detail::expression<boost::multiprecision::detail::function,boost::multiprecision::detail::log_funct<Backend>,boost::multiprecision::number<B,et_on>,void,void>>::type boost::multiprecision::log(const boost::multiprecision::number<B,et_on> &)'
1> With the following template arguments:
1> 'Backend=boost::multiprecision::backends::cpp_int_backend<0,0,signed_magnitude,unchecked,std::allocator<boost::multiprecision::limb_type>>'
1>Source.cpp(12): error C2784: 'enable_if_c<boost::multiprecision::number_category<boost::multiprecision::detail::expression<tag,Arg1,Arg2,Arg3,Arg4>>::value==number_kind_floating_point,boost::multiprecision::detail::expression<boost::multiprecision::detail::function,boost::multiprecision::detail::log_funct<detail::backend_type<boost::multiprecision::detail::expression<tag,Arg1,Arg2,Arg3,Arg4>>::type>,boost::multiprecision::detail::expression<tag,Arg1,Arg2,Arg3,Arg4>,void,void>>::type boost::multiprecision::log(const boost::multiprecision::detail::expression<tag,Arg1,Arg2,Arg3,Arg4> &)' : could not deduce …
Run Code Online (Sandbox Code Playgroud) 以下是在msvc上编译而不是在gcc上编译.为什么?
game_tracker.cpp:
#include "stdafx.hpp"
#include "game_tracker.hpp"
#include "basic_game_server.hpp"
#include "basic_session.hpp"
#include "api_session.hpp"
#include "protocols.hpp"
using namespace boost::asio;
using namespace std;
namespace games_zone{
game_tracker::game_tracker(unsigned short port) : tracker_(io_service(thread::hardware_concurrency())),
api_(io_service(thread::hardware_concurrency())),
acceptor_(api_, ip::tcp::endpoint(ip::tcp::v4(), port), false),
socket_(api_)
{
tracker_work_ = new boost::asio::io_service::work(tracker_);
api_work_ = new boost::asio::io_service::work(api_);
protocols::hl_game_server gs(boost::asio::ip::address_v4::from_string("89.44.246.184"), 27015);
add(gs);
}
...
}
Run Code Online (Sandbox Code Playgroud)
game_tracker.hpp:
#pragma once
#include "basic_game_server.hpp"
namespace games_zone{
class game_tracker :
private boost::noncopyable
{
public:
game_tracker(unsigned short);
~game_tracker();
void run();
private:
boost::asio::io_service tracker_;
boost::asio::io_service api_;
boost::asio::ip::tcp::acceptor acceptor_;
boost::asio::ip::tcp::socket socket_;
boost::asio::io_service::work* tracker_work_;
boost::asio::io_service::work* …
Run Code Online (Sandbox Code Playgroud)