草庐IT

Check_Program_Installed

全部标签

c++ - std::error_code,my_error::check_block == my_error::validate && my_error::accept_block == my_error::validate

我正在使用std::error_code并定义和注册了一堆错误(使用枚举类)。我有一个非常通用的错误,现在称为my_error::validate,但我想在我的库中提供更具体的版本。通常人们会想要使用:if(ec==bc::error::validate)//...但是有时他们可能希望看到与该std::error_code关联的特定错误或打印错误消息。//ec.message()says"check_block()failedtodoXYZ"assert(ec==bc::error::check_block);我希望能够启用如下功能:if(ec==bc::error::validate

c++ - 错误 : uint64_t was not declared in this scope when compiling C++ program

我正在尝试一个简单的程序来打印steady_clock的时间戳值,如下所示:#include#includeusingnamespacestd;intmain(){cout(steady_clock::now().time_since_epoch()).count();cout但是每当我像这样编译时g++-oabcabc.cpp,我总是会遇到错误:Infileincludedfrom/usr/include/c++/4.6/chrono:35:0,fromabc.cpp:2:/usr/include/c++/4.6/bits/c++0x_warning.h:32:2:error:#er

c++ - boost::program_options - 如何处理 INI 文件中具有相同名称的多个部分

在如下配置中;有没有办法处理各个部分。我正在寻找一种方法来以可靠的方式验证下面的各个“服务器”部分。[basic]number_of_servers=3[server]ip=10.20.30.40password=sdfslkhf[server]ip=10.20.30.41password=sdfslkhf[server]ip=10.20.30.42password=sdfslkhf[server]password=sdfslkhf[server]ip=10.20.30.42 最佳答案 当使用boost::program_optio

c++ - Ubuntu 上 Boost program_options 代码中的链接错误

我在ubuntu10.04上安装了boostsudoapt-getinstalllibboost-dev我想在那之后我不需要设置任何-I和-L标志,所以我编译我的代码g++test.cpp这是我的测试.cpp#include#include#include#include#include#include#includenamespacepod=boost::program_options::detail;intmain(){//contentsstd::stringstreams("a=1\n""b=2\n""c=testoption\n");//parametersstd::seto

c++ - BOOST_CHECK 无法为自定义类型编译 operator<<

我写了这个非常简单的类,以便清楚我的问题是什么:classA{public:intx;A(inty){x=y;}booloperator==(constA&other)const{returnx==other.x;}};现在,如果我定义Afirst(1)和Asecond(1),对我来说BOOST_CHECK_EQUAL(first,second)应该通过是很自然的。然而,我在尝试这样做时遇到了50个错误,第一个听起来像:nomathforoperator 最佳答案 我确定了三种方法来解决operator的问题.第一种方式是提供一个o

c++ - "The C++ compiler "/usr/bin/c++ "is not able to compile a simple test program."尝试安装 OpenCV 时

我正尝试按照此link在我的Mac上安装OpenCV但是,当我在终端上键入cmake-G"UnixMakefiles"..时,会打印出此错误。--TheCXXcompileridentificationisunknown--TheCcompileridentificationisunknown--CheckforworkingCXXcompiler:/usr/bin/c++--CheckforworkingCXXcompiler:/usr/bin/c++--brokenCMakeErrorat/opt/local/share/cmake-3.0/Modules/CMakeTestCXX

c++ - Visual Studio 2010 : Fatal Error C1902 about "program database manager"

这是来自MSDN的一些描述ErrorMessageprogramdatabasemanagermismatch;pleasecheckyourinstallationAprogramdatabasefile(.pdb)wascreatedusinganewerversionofmspdb80.dllthantheonefoundwhilecompiling.Thiserrorusuallyindicatesthatmspdbsrv.exeormspdbcore.dllaremissingorhavedifferentversionsfrommspdb80.dll.Ensurematch

c++ - 海森堡 : WinApi program crashes on some computers

求助!我真是无计可施了。我的程序是一个小的个人笔记管理器(谷歌搜索“cintanotes”)。在某些计算机上(当然我不拥有它们)它在启动后立即崩溃并出现未处理的异常。这些计算机没有什么特别之处,只是它们往往配备AMDCPU。环境:WindowsXP、VisualC++2005/2008、原始WinApi。关于这个“Heisenbug”,可以肯定的是:1)崩溃仅发生在Release版本中。2)一旦我删除了所有与GDI相关的内容,崩溃就会消失。3)BoundChecker没有任何提示。4)写日志显示崩溃发生在局部int变量的声明上!怎么可能呢?内存损坏?任何想法将不胜感激!更新:我已经成功

C++ boost::program_options 读取与 getopt_long 兼容的参数

我正在开发现有程序的更新。我正在用boost::program_options替换Posix的getopt_long()。但是我的工作没有按预期进行:我想阅读如下参数:-server=www.example.com-cconfig.txt我尝试了来自boost::program_options::command_line_style的多种可能性,但我找不到可以提供与getopt_long相同的行为的组合。我发现对于参数:-server=www.example.com我需要旗帜:command_line_style::allow_long_disguise|command_line_st

c++ - SIMD/SSE : How to check that all vector elements are non-zero

我需要检查所有vector元素是否非零。到目前为止,我找到了以下解决方案。有一个更好的方法吗?我在Linux/x86_64上使用gcc4.8.2,指令高达SSE4.2。typedefcharChrVect__attribute__((vector_size(16),aligned(16)));inlinebooltestNonzero(ChrVectvect){constChrVectvzero={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};return(0==(__int128_t)(vzero==vect));}更新:上面的代码被编译为以下汇编代码(当编译为非