Articles of 提升

C ++错误:睡眠没有在此范围内声明

我在Ubuntu中使用C ++代码块,在GCC 4.7中增加1.46 [yield_k.hpp] 我得到这个编译时间错误: error : Sleep was not declared in this scope 码: #include <iostream> using namespace std; int main() { cout << "nitrate"; cout << flush; sleep(1000); cout << "firtilizers"; return 0; } 我该如何解决这个错误? 我想要程序挂起1秒钟。

boost :: process抛出LNK2019:无法parsing的外部符号

我已经使用vcpkg安装了Boost。 现在我正在尝试使用Boost:进程的“Hello World”。 假设我从Boost开始评论一切工作正常 #include <iostream> //#include <boost/process.hpp> //#include <boost/process/windows.hpp> //namespace bp = boost::process; int main(int argc, char * argv[]) { int result = std::system("echo Hello"); } 现在,如果我取消注销升压,但不使用它,即我仍然打电话 std::system("echo Hello"); 它编译但是会抛出两个链接错误 "__declspec(dllimport) class boost::system::error_category const & __cdecl boost::system::system_category(void)" (__imp_?system_category@system@boost@@YAABVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'native_ecat''(void)" (??__Enative_ecat@system@boost@@YAXXZ) "__declspec(dllimport) class boost::system::error_category const & __cdecl […]

boost :: regex_search – 增强杀死我的脑细胞,再次

好的程序员保持简单的事情容易吗? 而且这不像增强文档让你的生活更不安… 我只想要一个实现: // fulfils the function of a regex matching where the pattern may match a // substring instead of the entire string bool search( std::string, std::string, SomeResultType ) 所以它可以用在: std::string text, pattern; SomeResultsType match; if( search( text, pattern, match ) ) { std::string result = match[0]; if( match[1].matched ) // where this is […]

升压1.44 –builddir和–includedir在Windows中不工作?

我试图build立一个特定的目录,而不是默认的Boost 1.44。 我通过从boost根目录执行以下步骤在我的linux机器上执行相同的操作: ./bootstrap.sh bjam –prefix = .. / .. / DIR 把libs编译成../../DIR/lib,把头文件编译成../../DIR/include。 我试图在我的Windows机器上做同样的事情,所以我试过: ./bootstrap bjam –prefix = .. / .. / DIR 但是直接将其构build到boost根构build区域。 我也试过bjam –builddir = .. / .. / DIR / lib –includedir = .. / .. / DIR / include 但是这似乎没有工作。 任何想法,我在做什么错了?

提升库名称缺less版本标记

我已经build立了提升根据文件使用: bjam.exe toolset=msvc-9.0 variant=release link=shared stage 这给了我在文件夹阶段的所有图书馆。 我得到每个升压包3个文件,例如: boost_regex-vc90-mt-1_45.dll boost_regex-vc90-mt-1_45.lib boost_regex-vc90-mt.lib boost_regex-vc90-mt-1_45.dll boost_regex-vc90-mt-1_45.lib boost_regex-vc90-mt.lib 什么是没有版本标签的lib文件? boost_regex-vc90-mt-1_45.lib和boost_regex-vc90-mt.lib有什么区别? boost文档声明如下: “扩展:根据操作系统惯例,在大多数unix风格的平台上扩展名分别是.a和.so,分别是静态库(archives)和共享库。在Windows上,.dll表示一个共享库和.lib表示一个静态库或者导入库,在unix版本的工具集支持的情况下,增加一个完整的版本扩展(比如“.so.1.34”),并且一个符号链接指向没有后续版本号的库文件“。 http://www.boost.org/doc/libs/1_45_0/more/getting_started/windows.html#library-naming 没有版本标签的文件是库文件的符号链接? 在Windows中的符号链接? 我不明白。

在MSVC 11中升压“析构函数不是虚拟的”错误

我想使用MSVC 11.0编译一个升压1.57.0的程序,我得到以下错误: z:\d\dev\boost_1_57_0\boost\exception\exception.hpp(171) : error C4265: 'boost::exception_detail::error_info_container' but destructor is not virtual instances of this class may not be destructed correctly 有什么我可以做的吗? 这些post似乎没有提供解决scheme http://boost.2283326.n4.nabble.com/boost-exception-detail-error-info-base-does-not-have-virtual-destructor-td3384903.html http://boost.2283326.n4.nabble.com/Re-exception-warning-about-non-virtual-destructor-resolution-td4554753.html

即使我设置了写入权限,也无法写入C:\中的文件

Windows 7,SP 1.我有一个C:\我想写的文件(我知道,我不应该,但是我们忽略它)。 我知道,作为一个用户,甚至没有提升的pipe理员,我不能。 所以我也为组Users添加了写入权限,但这没有帮助。 即使用“完全控制”权限添加我的用户也无济于事。 然而,“有效的权限”对话框显示了我的用户的写权限。 我如何设置文件权限,以便我可以写入文件? 我错过了什么? 编辑:如果这个问题不看程序员中心:作为一名程序员,我真的很想知道为什么文件不打开,文件权限如何真正起到提升作用。 编辑2:任何人都应该可以自己尝试:只需打开pipe理提示符,在C:\中创build一个文本文件,然后尝试从常规资源pipe理器访问它,而不用提升。

有没有办法映射一个networking驱动器(W /凭据)与Boost工作?

我有以下代码来检查目录是否存在。 #include <boost/filesystem.hpp> using namespace boost::filesystem; try { // Check whether the directory is valid if (!exists(dir) || !is_directory(dir)) { return false; } } catch (filesystem_error const & e) { return false; } 不幸的是,当试图导航到networking上另一台PC上的一个文件夹时会发生错误。 如果我尝试使用Windows资源pipe理器导航到文件夹,系统会提示input用户名和密码。 如果我input这些详细信息,然后再次运行我的代码,它可以find该文件夹​​,并不会收到错误。 如果我知道他们会是什么,有什么办法可以在代码中inputnetworking凭证吗?

C ++ CMake无法findBoost 1.63(使用CLion IDE)

我从字面上花了好几个小时,到处都是networking。 这是我所做的。 我在Windows 10上使用JetBrain CLion IDE。 直接下载MinGW 5.3,而不是通过CodeBlocks。 Downloaded Boost 1.63并解压缩。 运行bootstrap.bat gcc和b2.exe toolset=gcc来构build它。 在安装过程中, gcc-mingw-5.3.0出现了很多次,所以我想现在它们是以某种方式连接的。 然后出现一个新的文件夹C:/Boost ,它只包含两个文件夹:include和lib。 这是我的CMakeList.txt: cmake_minimum_required(VERSION 3.7) project(BoostTest) set(CMAKE_CXX_STANDARD 11) set(Boost_INCLUDE_DIR C:/Boost/include) set(BOOST_LIBRARY_DIR C:/Boost/lib) find_package(Boost COMPONENTS system filesystem REQUIRED) include_directories(${Boost_INCLUDE_DIR}) link_directories(${Boost_LIBRARY_DIR}) set(SOURCE_FILES main.cpp) add_executable(BoostTest ${SOURCE_FILES}) 由于原来的目录(我从下载解压缩)没有名为include和lib目录,我想我应该去安装(或build设)创build的目录。 然后我得到这个错误: CMake Error at D:/Program Files (x86)/JetBrains/CLion 2017.1/bin/cmake/share/cmake-3.7/Modules/FindBoost.cmake:1169 (file): file STRINGS file "C:/Boost/include/boost/version.hpp" cannot be […]

使用boost python的python模块是空的?

我正在尝试学习boost python API来创build我自己的python(3.6)模块。 我能够成功地编译下面的c ++代码,并得到我生成的pythonTest.dll。 #define BOOST_ALL_DYN_LINK #include <boost/python.hpp> #include <string> const std::string hello_world(void) { return std::string("hello world!\n"); } BOOST_PYTHON_MODULE(pythonTest) { namespace python = boost::python; python::def("hello_world", hello_world); } 然后,我将pythonTest.dll复制到我的模块文件夹,如下所示。 (我把pythonTest.dll重命名为pythonTest.pyd) pythonTest\ __init__.py pythonTest.pyd 当我执行python时,它会导入模块,但是它找不到我的hello_world函数: Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for […]