加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c – 尝试在cygwin中构建boost文件系统时出错:error:在’\

发布时间:2020-12-16 07:17:41 所属栏目:百科 来源:网络整理
导读:我安装了gg 5.4的cygwin 2.6.我安装了boost.build,它似乎正在工作.但是,当我尝试构建文件系统模块时,它失败并显示错误: work@PC /lib/boost_1_62_0/libs/filesystem/example/test$./build.shCompiling example programs...tut4.cpp:40:18: error: expected
我安装了gg 5.4的cygwin 2.6.我安装了boost.build,它似乎正在工作.但是,当我尝试构建文件系统模块时,它失败并显示错误:

work@PC /lib/boost_1_62_0/libs/filesystem/example/test
$./build.sh
Compiling example programs...
tut4.cpp:40:18: error: expected unqualified-id before '&&' token
tut4.cpp:40:18: error: expected ';' before '&&' token
tut4.cpp:40:23: error: expected ';' before ':' token
tut4.cpp:40:23: error: expected primary-expression before ':' token
tut4.cpp:40:23: error: expected ')' before ':' token
tut4.cpp:40:23: error: expected primary-expression before ':' token
tut4.cpp:45:18: error: expected unqualified-id before '&&' token
tut4.cpp:45:18: error: expected ';' before '&&' token
tut4.cpp:45:23: error: expected ';' before ':' token
tut4.cpp:45:23: error: expected primary-expression before ':' token
tut4.cpp:45:23: error: expected ')' before ':' token
tut4.cpp:45:23: error: expected primary-expression before ':' token
tut4.cpp:40:21: error: label 'x' used but not defined
../../../../boost/system/error_code.hpp: At global scope:
../../../../boost/system/error_code.hpp:221:36: warning: 'boost::system::posix_category' defined but not
 used [-Wunused-variable]
     static const error_category &  posix_category = generic_category();
../../../../boost/system/error_code.hpp:222:36: warning: 'boost::system::errno_ecat' defined but not use
d [-Wunused-variable]
     static const error_category &  errno_ecat     = generic_category();
../../../../boost/system/error_code.hpp:223:36: warning: 'boost::system::native_ecat' defined but not us
ed [-Wunused-variable]
     static const error_category &  native_ecat    = system_category();
path_info.cpp:41:13: error: 'element' does not name a type
path_info.cpp:44:3: error: expected ';' before 'cout'
path_info.cpp:49:62: error: expected ')' before ';' token
../../../../boost/system/error_code.hpp: At global scope:
../../../../boost/system/error_code.hpp:221:36: warning: 'boost::system::posix_category' defined but not
 used [-Wunused-variable]
     static const error_category &  posix_category = generic_category();
../../../../boost/system/error_code.hpp:222:36: warning: 'boost::system::errno_ecat' defined but not use
d [-Wunused-variable]
     static const error_category &  errno_ecat     = generic_category();
../../../../boost/system/error_code.hpp:223:36: warning: 'boost::system::native_ecat' defined but not us
ed [-Wunused-variable]
     static const error_category &  native_ecat    = system_category();

我该怎么做才能解决这个问题?

我在/usr/local /中安装b2并在/usr/local/share / boost-build中设置boost-build.jam以获得这些值:

# Copyright 2001,2002 Dave Abrahams
# Copyright 2002 Rene Rivera
# Copyright 2003 Vladimir Prus
# Distributed under the Boost Software License,Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)


boost-build src/kernel ;
using gcc : 5.4 : g++-5.4 : <cxxflags>=c++11 ;  // Could it be that this settings is wrong or not applying during compilation?

我正在尝试遵循official boost docs的指示,这说明我应该这样做:

$cd boost-root/libs/filesystem/example/test

$./setup.sh
Copying example programs...

$./build.sh
Compiling example programs...

$./tut1
Usage: tut1 path

解决方法

您的问题是由于您尝试在没有C 11支持的情况下构建代码而引起的,正如评论中已经提到的那样.

我不是一个提升专家,所以实际上不能说为什么你的jam文件中的设置不适用以及在boost env中解析这些设置的正确顺序是什么,因为我更喜欢自己编写命令.然而,如果有人能用* .jam文件解释你的错误,那将是非常好的.

但要解决问题,请使用以下内容:

b2 toolset = gcc cxxflags =“ – std = c 11”$*> build.log而不是./build.sh,您的项目将按预期编译.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读