Fixing the error: Access to instance member `GLib.FileStream.puts' denied

Fixing the error: Access to instance member `GLib.FileStream.puts' denied

我一直试图打开一个 .html 文件并在其中打印一些信息,但是出现编译错误,我无法在网上找到解决方案。也许我可以在这里找到一些建议。

代码如下:

def PrintOut(db: Database, which:string)
    var fi = FileStream.open("recipeprint.html", "w+")
    stmt:Statement = PreparedStatements.select_recipe( db, which )
    cols:int = stmt.column_count ()
    var row = new dict of string, string
    item:int = 1
    while stmt.step() == ROW
        for i:int = 0 to (cols - 1)
            row[ stmt.column_name( i ) ] = stmt.column_text( i )
        FileStream.puts( "<H1>%s</H1>", row[ "name" ])
        FileStream.puts( "<H2>Source: %s</H2>", row[ "source" ])
        FileStream.puts( "<H2>Servings: %s</H2>", row[ "servings" ])
        FileStream.puts( "<H3>Ingredient List: </H3>" )
        item++

我正在编译它:

valac "%f" --pkg sdl --pkg sqlite3 --pkg gee-0.8

但是,我一直收到错误消息:

valac "cookbook.gs" --pkg sdl --pkg sqlite3 --pkg gee-0.8 (no diretório: /home/luis/Dropbox/Documentos/Coding/Genie Programming Language) cookbook.gs:37.9-37.54: error: Access to instance member `GLib.FileStream.puts' denied
        FileStream.puts( "<H1>%s</H1>", row[ "name" ])
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cookbook.gs:38.9-38.64: error: Access to instance member `GLib.FileStream.puts' denied
        FileStream.puts( "<H2>Source: %s</H2>", row[ "source" ])
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cookbook.gs:39.9-39.68: error: Access to instance member `GLib.FileStream.puts' denied
        FileStream.puts( "<H2>Servings: %s</H2>", row[ "servings" ])
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

是不是和我安装的gee版本有关?

我的语法有误。 Filestream 是一个 class 实例化在变量 fi 中。所以问题是我应该写:

var entry = "<li>"+row[ "ingredients" ]+"</li>"
fi.puts( entry )

与Gee版本无关

帮助我理解问题的来源:here