问题描述
我使用Netbeans开发Java/JNI/C ++应用程序.在我的C ++类中,我使用static_assert,而Netbeans显示错误:
I use Netbeans to develop a Java / JNI / C++ application. In my c++ classes, I use static_assert and Netbeans displays an error:
static_assert(myvariable == 2, "My test.") ;
错误是:
Unable to resolve identifier static_assert
是的,我加入了"type_traits".
And yes, I've included "type_traits".
但是,代码可以编译并完美运行.那是NetBeans的错误吗?
But, the code compiles and runs perfectly. Is that a bug from NetBeans?
推荐答案
我在NetBeans上使用C ++已经有好几个月了,它似乎是NetBeans C ++的众多错误之一.很多时候,static_assert或其他函数被标记为红色,但仍可完美编译.如果此错误在将来的NetBeans版本中已修复,我将进行编辑.
I've used C++ on NetBeans for many months now, and it appears to be one of the many bugs of NetBeans with C++. Many times, static_assert or other functions were labeled red as an error, but compiled perfectly. I will edit if this bug is fixed in a future NetBeans release.
在template<typename T> typename std::enable_if<std::is_same<T, INT32>::value>::type
中也会发生. ::type
被标记为错误,但是一切都可以正常编译.
it also happens with template<typename T> typename std::enable_if<std::is_same<T, INT32>::value>::type
. ::type
is flagged as being an error, but everything compiles fine.
这篇关于在Netbeans上使用static_assert时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!