2013-12-14 36 views
3

按照doc,我有这样的程序:如何在D语言中使用用户定义的属性?

void main() { 
    @(3) 
    int var; 
} 

,但它只是不会编译:

test.d(2): identifier expected after @, not (
test.d(2): basic type expected, not 3 
test.d(2): no identifier for declarator int 
test.d(2): semicolon expected, not '3' 
test.d(2): found ')' when expecting ';' following statement 

回答

4

此功能是一个几个版本前加入。所以检查你的编译器版本,看看你是否需要更新。最新版本是v2.064.2。

如果您使用的是dmd run dmd -v。 如果您使用ldc2运行ldc2 -version。 GDC也有类似的方式。