Struct with float members in betterC
Azi Hassan via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Sep 5 04:58:18 PDT 2017
Hi,
I'm trying to create the following struct in betterC but I keep
getting undefined reference errors when I try to compile the code
:
import core.stdc.stdio;
struct Foo
{
float x;
float y;
float z;
};
extern(C) int main(int argc, char** argv)
{
/*auto foo = Foo(10, 2.0, 3.0);
printf("%f %f %f\n", foo.x, foo.y, foo.z);*/
puts("foo");
return 0;
}
Note that the mere presence of such a struct causes the
compilation to fail. The same problem occurs with a single float
member, or with double members.
$ dmd -betterC structbug.d
structbug.o:(.data._D13TypeInfo_xAya6__initZ+0x0) : référence
indéfinie vers « _D14TypeInfo_Const6__vtblZ »
structbug.o:(.data._D13TypeInfo_xAya6__initZ+0x8) : référence
indéfinie vers « _D12TypeInfo_Aya6__initZ »
collect2: error: ld returned 1 exit status
Error: linker exited with status 1
I'm aware that betterC is still experimental at this point, but I
thought I'd ask here to make sure it is indeed a bug before
filing a bug report. Thanks in advance.
More information about the Digitalmars-d-learn
mailing list