开发者

D lodepng compilation error

I have some trouble开发者_如何转开发 compiling lodepng (http://lodev.org/lodepng/) for D into my project.

In Encode.d I have the following code, where the compiler does not expect the assert statements. Removing this block solves the issue.

invariant
{
    assert(compressionLevel >=0 && compressionLevel <= 9, "invalid zlib compression level");
    assert(targetColorType == ColorType.Any ||
            targetColorType == ColorType.RGB ||
            targetColorType == ColorType.RGBA, "colortype is not supported");
}

In Decode.d I have even more trouble, with the error "no identifier for declarator inout(value)" for the middle line in:

info.backgroundColor.length = chunk.data.length / 2;
foreach(index, inout value; info.backgroundColor)
    value = chunk.data[index * 2];

Is there some trouble with old syntax here, and how do I fix it? Is there some other way to create png images in D in a simple manner?


Not sure about the invariant problem, but the second problem should be solved by replacing the "inout" with "ref" (D2 syntax change).


I gave up on lodepng, and used the code on http://www.dsource.org/projects/plot2kill/browser/trunk/png.d which works after some minor changes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜