Luatorrent编译错误

时间:2014-05-29 12:40:39

标签: c++ visual-studio-2008 boost lua

我正在尝试构建Luatorrent,一个Lua模块,它已经很老了,我真的只想添加一两个未完成的项目,但我无法获得它可以编译。

我正在使用' vintage'工具让我获得VS 2008并提升1.35.0。

我已将utils.h添加到Header Files并将torrent_session.cpp,torrent_info.cpp,torrent_handle.cpp和main.cpp添加到源文件。

添加了以下预处理器定义:

WIN32
_WINDOWS;
_USRDLL
WIN32_LEAN_AND_MEAN
_WIN32_WINNT=0x0500
BOOST_ALL_NO_LIB
_FILE_OFFSET_BITS=64
BOOST_THREAD_USE_LIB
UNICODE
TORRENT_USE_OPENSSL
NDEBUG

编译以下附加依赖项,没有错误,并添加:

libboost_system-vc90-mt-1_35.lib
libboost_filesystem-vc90-mt-1_35.lib
libboost_date_time-vc90-mt-1_35.lib
libboost_thread-vc90-mt-1_35.lib
lua51.lib
libeay32.lib
ssleay32.lib

添加以下附加包含头文件:

C:\Client\boost-1_35_0\
C:\Client\libtorrent\include\
C:\Client\libtorrent\include\libtorrent\
C:\Client\libtorrent\zlib\
C:\Client\OpenSSL\include\

PCH支持被禁用,并且根据ReadMe完成它应该编译没有错误但它从来没有投掷12个错误和17个警告,据我可以告诉警告可以忽略但是错误是我的需要帮助,这是日志:

 1>------ Build started: Project: Client, Configuration: Release Win32 ------
 1>Compiling...
 1>torrent_session.cpp
 1>C:\Client\libtorrent-0.12\include\libtorrent/session.hpp(86) : warning C4535: calling _set_se_translator() requires /EHa
 1>..\..\..\..\..\..\..\Client\Client Source\torrent_session.cpp(107) : error C2664: 'libtorrent::torrent_handle libtorrent::session::add_torrent(const libtorrent::torrent_info &,const boost::filesystem::path &,const libtorrent::entry &,bool,int)' : cannot convert parameter 1 from 'boost::intrusive_ptr<T>' to 'const libtorrent::torrent_info &'
 1>        with
 1>        [
 1>            T=libtorrent::torrent_info
 1>        ]
 1>        Reason: cannot convert from 'boost::intrusive_ptr<T>' to 'const libtorrent::torrent_info'
 1>        with
 1>        [
 1>            T=libtorrent::torrent_info
 1>        ]
 1>        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
 1>..\..\..\..\..\..\..\Client\Client Source\torrent_session.cpp(109) : error C2664: 'libtorrent::torrent_handle libtorrent::session::add_torrent(const libtorrent::torrent_info &,const boost::filesystem::path &,const libtorrent::entry &,bool,int)' : cannot convert parameter 1 from 'boost::intrusive_ptr<T>' to 'const libtorrent::torrent_info &'
 1>        with
 1>        [
 1>            T=libtorrent::torrent_info
 1>        ]
 1>        Reason: cannot convert from 'boost::intrusive_ptr<T>' to 'const libtorrent::torrent_info'
 1>        with
 1>        [
 1>            T=libtorrent::torrent_info
 1>        ]
 1>        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
 1>..\..\..\..\..\..\..\Client\Client Source\torrent_session.cpp(112) : error C2664: 'libtorrent::torrent_handle libtorrent::session::add_torrent(const libtorrent::torrent_info &,const boost::filesystem::path &,const libtorrent::entry &,bool,int)' : cannot convert parameter 1 from 'boost::intrusive_ptr<T>' to 'const libtorrent::torrent_info &'
 1>        with
 1>        [
 1>            T=libtorrent::torrent_info
 1>        ]
 1>        Reason: cannot convert from 'boost::intrusive_ptr<T>' to 'const libtorrent::torrent_info'
 1>        with
 1>        [
 1>            T=libtorrent::torrent_info
 1>        ]
 1>        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
 1>..\..\..\..\..\..\..\Client\Client Source\torrent_session.cpp(180) : warning C4244: 'argument' : conversion from 'libtorrent::size_type' to 'lua_Integer', possible loss of data
 1>..\..\..\..\..\..\..\Client\Client Source\torrent_session.cpp(181) : warning C4244: 'argument' : conversion from 'libtorrent::size_type' to 'lua_Integer', possible loss of data
 1>..\..\..\..\..\..\..\Client\Client Source\torrent_session.cpp(182) : warning C4244: 'argument' : conversion from 'libtorrent::size_type' to 'lua_Integer', possible loss of data
 1>..\..\..\..\..\..\..\Client\Client Source\torrent_session.cpp(183) : warning C4244: 'argument' : conversion from 'libtorrent::size_type' to 'lua_Integer', possible loss of data
 1>torrent_handle.cpp
 1>C:\Client\libtorrent-0.12\include\libtorrent/session.hpp(86) : warning C4535: calling _set_se_translator() requires /EHa
 1>..\..\..\..\..\..\..\Client\Client Source\torrent_handle.cpp(52) : warning C4244: 'argument' : conversion from 'libtorrent::size_type' to 'lua_Number', possible loss of data
 1>..\..\..\..\..\..\..\Client\Client Source\torrent_handle.cpp(53) : warning C4244: 'argument' : conversion from 'libtorrent::size_type' to 'lua_Number', possible loss of data
 1>..\..\..\..\..\..\..\Client\Client Source\torrent_handle.cpp(54) : warning C4244: 'argument' : conversion from 'libtorrent::size_type' to 'lua_Integer', possible loss of data
 1>..\..\..\..\..\..\..\Client\Client Source\torrent_handle.cpp(55) : warning C4244: 'argument' : conversion from 'libtorrent::size_type' to 'lua_Integer', possible loss of data
 1>..\..\..\..\..\..\..\Client\Client Source\torrent_handle.cpp(56) : warning C4244: 'argument' : conversion from 'libtorrent::size_type' to 'lua_Number', possible loss of data
 1>..\..\..\..\..\..\..\Client\Client Source\torrent_handle.cpp(57) : warning C4244: 'argument' : conversion from 'libtorrent::size_type' to 'lua_Number', possible loss of data
 1>..\..\..\..\..\..\..\Client\Client Source\torrent_handle.cpp(80) : warning C4244: 'argument' : conversion from 'libtorrent::size_type' to 'lua_Integer', possible loss of data
 1>..\..\..\..\..\..\..\Client\Client Source\torrent_handle.cpp(81) : warning C4244: 'argument' : conversion from 'libtorrent::size_type' to 'lua_Integer', possible loss of data
 1>..\..\..\..\..\..\..\Client\Client Source\torrent_handle.cpp(451) : warning C4244: 'argument' : conversion from 'const libtorrent::size_type' to 'lua_Integer', possible loss of data
 1>..\..\..\..\..\..\..\Client\Client Source\torrent_handle.cpp(452) : warning C4244: 'argument' : conversion from 'const libtorrent::size_type' to 'lua_Integer', possible loss of data
 1>..\..\..\..\..\..\..\Client\Client Source\torrent_handle.cpp(470) : warning C4244: 'argument' : conversion from 'const libtorrent::size_type' to 'lua_Integer', possible loss of data
 1>..\..\..\..\..\..\..\Client\Client Source\torrent_handle.cpp(479) : error C2039: 'peer_source_flags' : is not a member of 'libtorrent::peer_info'
 1>        C:\Client\libtorrent-0.12\include\libtorrent/peer_info.hpp(46) : see declaration of 'libtorrent::peer_info'
 1>..\..\..\..\..\..\..\Client\Client Source\torrent_handle.cpp(537) : error C2039: 'upload_limit' : is not a member of 'libtorrent::torrent_handle'
 1>        C:\Client\libtorrent-0.12\include\libtorrent/torrent_handle.hpp(216) : see declaration of 'libtorrent::torrent_handle'
 1>..\..\..\..\..\..\..\Client\Client Source\torrent_handle.cpp(552) : error C2039: 'download_limit' : is not a member of 'libtorrent::torrent_handle'
 1>        C:\Client\libtorrent-0.12\include\libtorrent/torrent_handle.hpp(216) : see declaration of 'libtorrent::torrent_handle'
 1>..\..\..\..\..\..\..\Client\Client Source\torrent_handle.cpp(575) : error C2039: 'piece_priority' : is not a member of 'libtorrent::torrent_handle'
 1>        C:\Client\libtorrent-0.12\include\libtorrent/torrent_handle.hpp(216) : see declaration of 'libtorrent::torrent_handle'
 1>..\..\..\..\..\..\..\Client\Client Source\torrent_handle.cpp(577) : error C2039: 'piece_priority' : is not a member of 'libtorrent::torrent_handle'
 1>        C:\Client\libtorrent-0.12\include\libtorrent/torrent_handle.hpp(216) : see declaration of 'libtorrent::torrent_handle'
 1>..\..\..\..\..\..\..\Client\Client Source\torrent_handle.cpp(608) : error C2039: 'prioritize_pieces' : is not a member of 'libtorrent::torrent_handle'
 1>        C:\Client\libtorrent-0.12\include\libtorrent/torrent_handle.hpp(216) : see declaration of 'libtorrent::torrent_handle'
 1>..\..\..\..\..\..\..\Client\Client Source\torrent_handle.cpp(624) : error C2039: 'piece_priorities' : is not a member of 'libtorrent::torrent_handle'
 1>        C:\Client\libtorrent-0.12\include\libtorrent/torrent_handle.hpp(216) : see declaration of 'libtorrent::torrent_handle'
 1>..\..\..\..\..\..\..\Client\Client Source\torrent_handle.cpp(659) : error C2039: 'prioritize_files' : is not a member of 'libtorrent::torrent_handle'
 1>        C:\Client\libtorrent-0.12\include\libtorrent/torrent_handle.hpp(216) : see declaration of 'libtorrent::torrent_handle'
 1>..\..\..\..\..\..\..\Client\Client Source\torrent_handle.cpp(674) : error C2039: 'scrape_tracker' : is not a member of 'libtorrent::torrent_handle'
 1>        C:\Client\libtorrent-0.12\include\libtorrent/torrent_handle.hpp(216) : see declaration of 'libtorrent::torrent_handle'
 1>Build log was saved at "file://c:\Users\User\Documents\Visual Studio 2008\Projects\Client\Client\Release\BuildLog.htm"
 1>Client - 12 error(s), 17 warning(s)
 ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

错误1引用此[th = s-&gt; add_torrent(t,path,e)],错误2和3是相同的错误代码:

static int torrent_session_add_torrent(lua_State *L) {
 int n = lua_gettop(L);
 void* ud = 0;

 ud = luaL_checkudata(L, 1, "Torrent.Session");
 session *s = *((session **)ud);

 ud = luaL_checkudata(L, 2, "Torrent.Info");
 torrent_info *ti = *((torrent_info **)ud);

 boost::intrusive_ptr<torrent_info> t(ti);

 try {
torrent_handle th;

if (n >= 3 && !lua_isnil(L, 3)) {
    const char *path = "./";

    if (!lua_isnil(L, 3)) {
    path = luaL_checkstring(L, 3);
    }

    if (n == 4 && !lua_isnil(L, 4)) {
    const char *filename = luaL_checkstring(L, 4);

    std::ifstream in(filename, std::ios_base::binary);
    in.unsetf(std::ios_base::skipws);

    entry e = bdecode(std::istream_iterator<char>(in), std::istream_iterator<char>());

    th = s->add_torrent(t, path, e);
    } else {
    th = s->add_torrent(t, path);
    }
} else {
    th = s->add_torrent(t, "./");
}

torrent_handle **h = (torrent_handle **)lua_newuserdata(L, sizeof(torrent_handle *));
*h = new torrent_handle(th);

luaL_getmetatable(L, "Torrent.Handle");
lua_setmetatable(L, -2);
 } catch (std::exception& e) {
luaL_error(L, "%s", e.what());
lua_pushnil(L);
 }

 return 1;
}

所有其他错误都在torrent_handle.cpp中引用了这一点,其中它认为返回的表项不是&lib;以下的成员:libtorrent :: torrent_handle&#39;:

static int torrent_handle_get_peer_info(lua_State *L) {
 void* ud = 0;

 ud = luaL_checkudata(L, 1, "Torrent.Handle");
 torrent_handle *h = *((torrent_handle **)ud);

 std::vector<peer_info> peers;

 h->get_peer_info(peers);

 int c = 1;
 lua_newtable(L);
 for (std::vector<peer_info>::const_iterator i = peers.begin(); i != peers.end(); ++i) {
    lua_pushinteger(L, c);

    lua_newtable(L);
    LUA_PUSH_ATTRIB_INT("flags", i->flags);

std::ostringstream out;
out << i->ip;
LUA_PUSH_ATTRIB_STRING("ip", out.str().c_str());

    LUA_PUSH_ATTRIB_FLOAT("up_speed", i->up_speed);
    LUA_PUSH_ATTRIB_FLOAT("down_speed", i->down_speed);
    LUA_PUSH_ATTRIB_FLOAT("payload_up_speed", i->payload_up_speed);
    LUA_PUSH_ATTRIB_FLOAT("payload_down_speed", i->payload_down_speed);
    LUA_PUSH_ATTRIB_INT("total_download", i->total_download);
    LUA_PUSH_ATTRIB_INT("total_upload", i->total_upload);
//pid
//pieces

std::vector<bool> pieces = i->pieces;
lua_pushstring(L, "pieces");
lua_newtable(L);
int d = 1;
for (std::vector<bool>::const_iterator b = pieces.begin(); b != pieces.end(); ++b) {
    LUA_PUSH_ARRAY_BOOL(d, *b);
}   

lua_settable(L, -3);

LUA_PUSH_ATTRIB_BOOL("seed", i->seed);
    LUA_PUSH_ATTRIB_INT("upload_limit", i->upload_limit);
    LUA_PUSH_ATTRIB_INT("download_limit", i->download_limit);
    LUA_PUSH_ATTRIB_STRING("country", i->country);
    LUA_PUSH_ATTRIB_INT("load_balancing", i->load_balancing);
    LUA_PUSH_ATTRIB_INT("download_queue_length", i->download_queue_length);
    LUA_PUSH_ATTRIB_INT("upload_queue_length", i->upload_queue_length);
    LUA_PUSH_ATTRIB_INT("downloading_piece_index", i->downloading_piece_index);
    LUA_PUSH_ATTRIB_INT("downloading_block_index", i->downloading_block_index);
    LUA_PUSH_ATTRIB_INT("downloading_progress", i->downloading_progress);
    LUA_PUSH_ATTRIB_INT("downloading_total", i->downloading_total);
    LUA_PUSH_ATTRIB_STRING("client", i->client.c_str());
    LUA_PUSH_ATTRIB_INT("connection_type", i->connection_type);
    LUA_PUSH_ATTRIB_INT("peer_source_flags", i->peer_source_flags);
    lua_settable(L, -3);

    c++;
 }

 return 1;
}

我有一个预先计算的dll所以我知道代码确实有效,但显然无法重建它我无法添加我需要的额外功能。

0 个答案:

没有答案