Boost.preprocessor : BOOST_PP_EQUAL not working
Boost.preprocessor : BOOST_PP_EQUAL not working
你好,我对C中的Boost.Preprocessor有问题。我相信C++和C宏的行为完全相同,所以使用Boost。预处理器在C中很好,无论如何,我打算做一个小型的完全预处理器库。我的问题是我不能用BOOST_PP_EQUAL
编译一个小程序。以下是您可以构建的示例代码:
#include <stdlib.h>
#include <stdio.h>
#include <boost/preprocessor.hpp>
#define TUPLE (0,1,2)
#define IS_NON_ZERO(NODE) BOOST_PP_EQUAL(BOOST_PP_TUPLE_SIZE(NODE),0)
int main(void)
{
int x;
x = IS_NON_ZERO(TUPLE);
printf("result: %dn",x);
return EXIT_SUCCESS;
}
我使用的是clang和gcc,它们都告诉我宏BOOST_PP_NOT_EQUALS不存在!
tiny.c:6:27: error: ‘BOOST_PP_NOT_EQUAL_0’ undeclared (first use in this function)
我的代码出了什么问题?提前感谢!
EDIT:这是使用-E
标志的非宏行。
x = BOOST_PP_COMPL_BOOST_PP_NOT_EQUAL_CHECK_BOOST_PP_NOT_EQUAL_BOOST_PP_TUPLE_SIZE((0,1,2))(0, BOOST_PP_NOT_EQUAL_0);
怎么了?
将-DBOOST_PP_VARIADICS=1
传递给编译器。
相关文章:
- OpenMP卸载说'fatal error: could not find accel/nvptx-none/mkoffload'
- 使用JsonCpp将数据返回到带有pybind11的python会在python调用中产生Symbol not foun
- OpenCV Android C++ imwrite not found
- 应用程序崩溃并显示"symbol _ZdlPvm, version Qt_5 not defined in file libQt5Core.so.5 with link time reference"
- 使用单词"not"作为C ++类的名称会导致VS2019错误
- 错误"Could not find Boost"(缺少:上下文标头)
- 如何修复"error: ‘_1’ was not declared in this scope"?
- 套接字连接"Operation not permitted"错误,甚至使用升压/平发器根.cpp
- Is !NaN not a NaN?
- 为什么我会" void value not ignored as it ought to be"?
- 如何使用"equal to"以外的评估编写开关语句
- 解决"ld: library not found for -ltensorflow_framework.2.3.0"
- 加载与引用 .NET DLL 位于同一文件夹中的引用的 .NET DLL 时"Not found"异常
- Directx 11 - CompileFromFile() is not compiling
- 方法错误"not all control paths return a value"和方法不返回值
- Centos7 g++ "to_string is not in a member of std"
- C++有"not equal compare and exchange"或"fetch add on not equal"吗?
- 我怎样才能写得"if not greater than or equal to some value"雄辩?
- (false - NOT (0)) is equal to 1?
- if-else 语句中的"equal to"运算符与"not equal to"运算符