c++ - Boost_1_72_0 错误:宏“test”传递了 2 个参数,但只需要 1 个
问题描述
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11) centos-release-7-3.1611.el7.centos.x86_64 提升:1.72.0
编译我的 c++ 代码时出现以下错误:
In file included from /home/hadoop/work/external-lib/boost_1_72_0/boost/mpl/apply_wrap.hpp:23:0,
from /home/hadoop/work/external-lib/boost_1_72_0/boost/mpl/apply.hpp:23,
from /home/hadoop/work/external-lib/boost_1_72_0/boost/iterator/iterator_facade.hpp:36,
from /home/hadoop/work/external-lib/boost_1_72_0/boost/range/iterator_range_core.hpp:27,
from /home/hadoop/work/external-lib/boost_1_72_0/boost/algorithm/string/replace.hpp:16,
from /home/hadoop/work/external-lib/boost_1_72_0/boost/date_time/date_facet.hpp:17,
from /home/hadoop/work/external-lib/boost_1_72_0/boost/date_time/gregorian/gregorian_io.hpp:16,
from /home/hadoop/work/external-lib/boost_1_72_0/boost/date_time/gregorian/gregorian.hpp:31,
from /home/hadoop/work/external-lib/boost_1_72_0/boost/date_time/posix_time/time_formatters.hpp:12,
from /home/hadoop/work/external-lib/boost_1_72_0/boost/date_time/posix_time/posix_time.hpp:24,
from /home/hadoop/work/external-lib/boost_1_72_0/boost/date_time/local_time/local_time.hpp:11,
from /home/hadoop/work/external-lib/boost_1_72_0/boost/date_time.hpp:15,
from /home/hadoop/work/db/connection.cpp:6:
/home/hadoop/work/external-lib/boost_1_72_0/boost/mpl/aux_/has_apply.hpp:22:58: error: macro "test" passed 2 arguments, but takes just 1
BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(has_apply, apply, false)
db/connection.cpp 文件是:
#include "connection.h"
#include <cppconn/driver.h>
#include <cppconn/exception.h>
#include <cppconn/resultset.h>
#include <cppconn/statement.h>
#include <boost/date_time.hpp> // Error at this line
db::Connection::Connection() {
m_driver = sql::mysql::get_mysql_driver_instance();
m_driver->threadInit();
m_con = m_driver->connect("tcp://<host>:<port>", "<user>", "<pwd>");
m_con->setSchema("test");
m_stmt = m_con->createStatement();
}
我不打任何 boost::date_time 电话。只包括头文件(暂时)。
值得一提的是,MySQL 代码也访问了 boost 库(内部),当我注释掉 boost/date_time 头文件时,我没有收到任何错误。
解决方案
推荐阅读
- codeigniter-3 - 使用 required 和回调函数使用验证表单时出错
- azure - 我需要在使用 PowerShell 创建 Azure VMSS 时指定操作系统磁盘名称
- accelerometer - 如何将原始加速度计数据转换为有关重复运动的信息
- ios - 如何使用我从情节提要添加的页面控件?迅速
- python - 我们可以在异步函数中使用 Flask test_client()
- python - Python 数据框总结
- java - 如何将其从 Scanner 更改为 BufferedReader?
- javascript - 使用 Vue 渲染时加载相同的两个页面
- hadoop - 我可以从 ryzen 5000 系列笔记本电脑连接 hadoop localhost 服务器吗?
- python - 为什么我收到 TypeError: 'str' object is not callable, in reversed() 函数?