2013-12-14 33 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也有類似的方式。