fromStringz problem with gdc

Iain Buclaw via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Apr 6 10:55:37 PDT 2015


On Monday, 6 April 2015 at 17:47:27 UTC, chardetm wrote:
> Hello everyone,
>
> I have a problem with the fromStringz function 
> (std.string.fromStringz) when I try to compile with the GDC 
> compiler (it works fine with DMD).
>
> Here is a minimal code to see the error:
>
>
> import std.stdio, std.string, std.c.stdlib;
>
> int main () {
>     char* s;
>     s = cast(char*) malloc(2);
>     s[0] = 'a';
>     s[1] = '\0';
>     writeln(fromStringz(s));
>     return 0;
> }
>
>
> Compiling with DMD (works fine):
> $ dmd testfsz.d
>
> Compiling with GDC:
> $ gdc testfsz.d -o testfsz
> testfsz.d:8: error: undefined identifier fromStringz
>
> It does the same thing on a friend's computer. I'm using GCC 
> 4.9.1 on Kubuntu 14.10.
> Any idea where this comes from? Thanks in advance for your help!

fromStringz (in std.string) was introduced in D 2.066, gdc-4.9 
was shipped when 2.065 was released.

Iain.


More information about the Digitalmars-d-learn mailing list