在 macos 上编译 Wt 失败并显示 boost::filesystem::directory_iterator end_itr

问题描述 投票:0回答:1

根据安装:类 Unix 平台(Linux、macOS、BSD...)中概述的步骤在 Macos 上构建 Wt 时,我遇到了此错误,并且构建结束,但未完成输出以下错误消息。 感谢任何有关此错误的反馈。

没有名为“directory_iterator”的成员

构建步骤:

%> cd <wt/download/directory>
%> mkdir build
%> cd build
%> cmake ../
%> make -j8

执行此过程时,make 步骤失败,并显示以下内容:

[ 69%] Building CXX object src/CMakeFiles/wt.dir/web/SslUtils.C.o
/Users/user1/Development/C-Projects/wt-4.10.4/src/web/FileUtils.C:82:26: error: no type named 'directory_iterator' in namespace 'boost::filesystem'; did you mean 'directory_entry'?
   82 |       boost::filesystem::directory_iterator end_itr;
      |       ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
      |                          directory_entry
/usr/local/include/boost/filesystem/detail/path_traits.hpp:51:7: note: 'directory_entry' declared here
   51 | class directory_entry;
      |       ^
/Users/user1/Development/C-Projects/wt-4.10.4/src/web/FileUtils.C:82:45: error: variable has incomplete type 'boost::filesystem::directory_entry'
   82 |       boost::filesystem::directory_iterator end_itr;
      |                                             ^
/usr/local/include/boost/filesystem/detail/path_traits.hpp:51:7: note: forward declaration of 'boost::filesystem::directory_entry'
   51 | class directory_entry;
      |       ^
/Users/user1/Development/C-Projects/wt-4.10.4/src/web/FileUtils.C:91:31: error: no member named 'directory_iterator' in namespace 'boost::filesystem'
   91 |       for (boost::filesystem::directory_iterator i(path); i != end_itr; ++i) {
      |            ~~~~~~~~~~~~~~~~~~~^
/Users/thomaspeters/Development/C-Projects/wt-4.10.4/src/web/FileUtils.C:91:59: error: use of undeclared identifier 'i'
   91 |       for (boost::filesystem::directory_iterator i(path); i != end_itr; ++i) {
      |                                                           ^
/Users/user1/Development/C-Projects/wt-4.10.4/src/web/FileUtils.C:91:75: error: use of undeclared identifier 'i'
   91 |       for (boost::filesystem::directory_iterator i(path); i != end_itr; ++i) {
      |                                                                           ^
/Users/user1/Development/C-Projects/wt-4.10.4/src/web/FileUtils.C:92:27: error: use of undeclared identifier 'i'
   92 |         std::string f = (*i).path().string();
      |                           ^
1 warning and 6 errors generated.

增强版本:

10-85-00

我能够使用 bootstrap 和 b2 install 成功构建和安装 Boost。

Macos 版本:

ProductName:        macOS
ProductVersion:     15.0
BuildVersion:       24A5298h

处理器:

2.3 GHz 8-Core Intel Core i9

Wt版本:

wt-4.10.4
macos cmake makefile build wt
1个回答
0
投票

注意错误消息的症结所在:

/Users/user1/Development/C-Projects/wt-4.10.4/src/web/FileUtils.C:82:26: error: no type named 'directory_iterator' in namespace 'boost::filesystem'; did you mean 'directory_entry'?
   82 |       boost::filesystem::directory_iterator end_itr;
      |       ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
      |                          directory_entry

这是因为

wt-4.10.4/src/web/FileUtils.C
缺少
boost::filesystem
的包含语句。自己将其添加到该文件的第 10 行,如下:

  /*
   * Copyright (C) 2012 Emweb bv, Herent, Belgium.
   *
   * See the LICENSE file for terms of use.
   */

  #include "web/FileUtils.h"

  #include <boost/filesystem/operations.hpp>
  #include <boost/filesystem.hpp>             // <-- add this line

  #include "web/WebUtils.h"
  #include "Wt/WException.h"
  #include "Wt/WLogger.h"

之后,再次运行

make
wt-4.10.4/src/web/FileUtils.C
就可以正常编译了。

这是

wt-4.10.4
中的错误,您应该将其报告给他们。

请注意,

wt-4.10.4
中还有其他问题会阻止其完全构建。

© www.soinside.com 2019 - 2024. All rights reserved.