标识符“__builtin_expect”未定义(在 ROS on win tutorial-talker 示例中)

identifier "__builtin_expect" is undefined (during ROS on win tutorial-talker example)

我想在 Visual Studio 2015 年 Windows 上做 first tutorial of ROS

首先我创建了一个新的 WIN 32 控制台应用程序并从 here 复制了代码。 然后我按照指南中的描述配置了项目。调试时出现了几个错误:

wiki.ros.org的SDK运行,我测试了。 我不知道出了什么问题。 我希望有人能帮助我。

提前致谢!!

__builtin_expect is a GCC 分机。它不是由 Visual Studio 提供的。

因为它只向编译器提供针对 CPU branch-prediction 优化的提示,所以可以将 __builtin_expect(expr, c) 的所有实例替换为 expr.

或者,在合适的情况下,使用__assume instead, as described in this answer