www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Struct with float members in betterC

reply Azi Hassan <azi.hassan live.fr> writes:
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.
Sep 05
parent user1234 <user1234 12.hu> writes:
On Tuesday, 5 September 2017 at 11:58:18 UTC, Azi Hassan wrote:
 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 :

 [...]

 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.
bug +1.
Sep 05