【发布时间】:2021-03-11 08:20:19
【问题描述】:
这是代码:
#pragma once
#include <stdint.h>
namespace Detours
{
static_assert(sizeof(uintptr_t) == sizeof(void *));
}
我收到此错误消息:
Error (active) E2783 expected a comma (the one-argument version of static_assert is not enabled in this mode)
【问题讨论】:
-
定义“不起作用”。你期望什么结果,你观察到什么结果?
-
Error (active) E2783 expected a comma (the one-argument version of static_assert is not enabled in this mode) 这是我遇到的错误
-
static_assert在 C++17 之前需要第二个参数 - 错误消息。显然,您的编译器中未启用 C++17。要么弄清楚如何启用它,要么添加错误消息,如static_assert(condition, "Error message here") -
您可能还是想添加一条错误消息。
-
在项目设置中启用
c++17。属性 -> C/C++ -> 语言 -> “C++ 语言标准”
标签: c++ static-assert