在Ubuntu 10.04上使用kdevelop 3.5构建我的应用程序时,我收到以下错误:
libtool: Version mismatch error. This is libtool 2.2.6 Debian-2.2.6a-4, but the
libtool: definition of this LT_INIT comes from libtool 2.2.6b.
libtool: You should recreate aclocal.m4 with macros from libtool 2.2.6 Debian-2.2.6a-4
libtool: and run autoconf again.
make[2]: *** [wktools4] Error 63
make[2]: Target `all' not remade because of errors.
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
*** Exited with status: 2 ***
Run Code Online (Sandbox Code Playgroud)
我在哪里可以获得所需的libtool版本,或者如何重新创建aclocal.m4?
构建(用于Linux)用Visual Studio编写的C++应用程序的最佳和最简单的方法是什么?代码本身已准备就绪 - 我只使用跨平台库.
是否可以在Visual Studio中的Windows下准备一切,然后在Linux下使用CLI工具构建它?有没有文件描述这个?
编辑:更多信息:
Libs使用:stl,wxwidgets,boost,asio,cryptlib.
Linux知识很少.
编辑#2:我选择了以下解决方案:使用kdevelop创建新项目并在那里编译所有内容.
我想用asio进行DNS反向查找(返回给定IP地址的主机名),但我无法弄清楚我需要哪些组件来实现这一点.Asio文献指的是ip::basic_resolver::resolve,但是endpoint_type需要一个,我不知道如何使用它.
有人可以发帖或参考一个例子吗?
编辑:
在Joachim Pileborg的帮助下,我完成了任务.需要的代码(Minumin没有错误处理):
#include <asio.hpp>
#include <string>
#include <iostream>
int main()
{
asio::ip::address_v4 ipa = asio::ip::address_v4::from_string("8.8.8.8");
asio::ip::tcp::endpoint ep;
ep.address(ipa);
asio::io_service io_service;
asio::ip::tcp::resolver resolver(io_service);
asio::ip::tcp::resolver::iterator destination = resolver.resolve(ep);
std::cout << destination->host_name() << std::endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud) 有一种简单的方法将ASCII std :: string转换为HEX?我不想将它转换为数字,我只想将每个ASCII字符转换为它的HEX值.输出格式也应该是std :: string.即:"TEST"将是"0x54 0x45 0x53 0x54"或类似的格式.
我找到了这个解决方案,但也许有一个更好的解决方案(没有字符串到int到字符串转换):
std::string teststring = "TEST";
std::stringstream hValStr;
for (std::size_t i=0; i < teststring.length(); i++)
{
int hValInt = (char)teststring[i];
hValStr << "0x" << std::hex << hValInt << " ";
}
Run Code Online (Sandbox Code Playgroud)
谢谢,
/ mspoerr
我想使用与luabind超过10个参数的函数,但我得到一些C2784和C2780编译器错误(VS2012 Express).
似乎问题是使用的boost库的限制.在luabind中,可以设置LUABIND_MAX_ARITY选项,但这取决于boost的可能性.我怎么能克服这种限制?
谢谢!
码:
luabind::module(lua) [
luabind::class_<WkmParserDB>("WkmParserDB")
.def("insertInterface", &WkmParserDB::insertInterface)
.def("insertIntfStats", &WkmParserDB::insertIntfStats)
.def("intertIntfN1k", &WkmParserDB::intertIntfN1k)
];
Run Code Online (Sandbox Code Playgroud)
函数insertIntfStats有大约20个std :: string参数,没有别的.另外两个函数的参数少于8个(std :: string也是如此).当我评论".def("insertIntfStats",&WkmParserDB :: insertIntfStats)这一行时,它编译并运行.
错误:
Fehler 3 error C2784: "boost::mpl::vector12<R,const most_derived<T,Wrapped>::type&,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9> luabind::detail::deduce_signature(R (__thiscall T::* )(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9) const,Wrapped *)": template-Argument für "R (__thiscall T::* )(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9) const" konnte nicht von "std::basic_string<_Elem,_Traits,_Alloc> " hergeleitet werden. d:\programmieren\luabind-0.9.1\luabind\class.hpp 311 1 wktools4
Fehler 4 error C2780: 'boost::mpl::vector12<R,const T&,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9> luabind::detail::deduce_signature(R (__thiscall T::* )(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9) const)': Erwartet 1 Argumente - 2 unterstützt d:\programmieren\luabind-0.9.1\luabind\class.hpp 311 1 wktools4
Fehler 5 error C2784: …Run Code Online (Sandbox Code Playgroud) 我正在使用C++ system()函数运行一些命令:
int system ( const char * command );
Run Code Online (Sandbox Code Playgroud)
如何从发出的命令中收集标准输出?
具体来说,我想收集已发出命令的输出(例如,发出命令的目录列表输出dir).
我找到了以下线程:
从ip和子网掩码计算广播地址,并链接到http://lpccomp.bc.ca/netmask/netmask.c
有人可以解释下面这行,我不明白:
for ( maskbits=32 ; (mask & (1L<<(32-maskbits))) == 0 ; maskbits-- )
Run Code Online (Sandbox Code Playgroud)
特别 mask & (1L<<(32-maskbits))
我在我的应用程序中使用同步 boost::asio SSL 套接字。我初始化所有参数,然后连接到一些主机(一个接一个)并为每个主机执行 GET 请求。
一切正常,直到我收到其中一个主机的“404 - Not Found”错误。出现此错误后,所有新连接都会失败,并显示一些未指定的 SSL 错误。
我是否必须以某种方式重置 ssl::stream?是否可以在每次连接后重新初始化 ssl::stream?
在下面的代码片段中,我删除了错误处理和所有非 asio 相关的东西。
主要的:
asio::io_service ioservice;
asio::ssl::context ctx(ioservice, asio::ssl::context::sslv23);
ctx.set_verify_mode(asio::ssl::context::verify_none);
Connector *con = new Connector(ioservice, ctx);
while (!iplist.empty())
{
...
con->ssl_connect(ipaddress, port);
...
}
Run Code Online (Sandbox Code Playgroud)
连接器:
Connector::Connector(asio::io_service& io_service, asio::ssl::context &ctx)
: sslSock(io_service, ctx)
{
}
Connector::ssl_connect(std::string ipAdr, std::string port)
{
...
tcp::resolver resolver(ioserv);
tcp::resolver::query query(ipAdr, port);
endpoint_iterator = resolver.resolve(query);
...
asio::error_code errorcode = asio::error::host_not_found;
tcp::resolver::iterator end;
// Establish connection
while (errorcode && endpoint_iterator != end)
{ …Run Code Online (Sandbox Code Playgroud) 我有四列,其中一个表col1&col2包含相似的值(INT).我现在想知道是否有重复col1和/或col2.即
col1 | col2
-----+-----
111 | 222
333 | 444
111 | 333
555 | 111
Run Code Online (Sandbox Code Playgroud)
→重复:111(3x)和333(2x).
我正在使用SQLite,但我认为这是一个基本的SQL问题.
我想在我的程序中使用boost :: thread,但是得到以下编译器错误(Visual Studio 2005):
Error 1 **error C2064**: term does not evaluate to a function taking 0
arguments d:\...\boost_1_37_0\boost\thread\detail\thread.hpp 56
Run Code Online (Sandbox Code Playgroud)
因此,我尝试在一个小程序中重新创建问题,并从此站点修改了工作的Hello World示例.
我的测试代码现在看起来像这样.为什么不在课堂上工作?:
#include <boost/thread.hpp>
#include <iostream>
class HelloWorld
{
public:
void hello();
void entry();
};
void HelloWorld::entry()
{
boost::thread thrd(&HelloWorld::hello);
thrd.join();
}
void HelloWorld::hello()
{
std::cout << "Hello world, I'm a thread!" << std::endl;
}
int main(int argc, char* argv[])
{
HelloWorld *bla = new HelloWorld;
bla->entry();
return 0;
}
Run Code Online (Sandbox Code Playgroud) 我尝试在Ubuntu 10.04上使用kdevelop 3.5.4编译应用程序,但它失败并出现以下错误:
checking whether make sets $(MAKE)... yes
checking for g++... g++
checking whether the C++ compiler works... no
configure: error: in `/home/nts/wktools4':
configure: error: C++ compiler cannot create executables
See `config.log' for more details.
*** Exited with status: 77 ***
Run Code Online (Sandbox Code Playgroud)
的config.log:
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by configure, which was
generated by GNU Autoconf 2.65. Invocation command line was
$ /home/nts/wktools4/configure …Run Code Online (Sandbox Code Playgroud)