Linux build fail on vec234.h (anonymous union)

24 views
Skip to first unread message

sduclos

unread,
Jan 18, 2012, 6:10:13 AM1/18/12
to freetype-gl
Hi,

I'm trying to build (make) freetype-gl on today source from
freetype-gl.googlecode.com/svn/trunk/, and gcc spit this:

freetype-gl$ make
Building demo-benchmark.o...
In file included from freetype-gl.h:57:0,
from demo-benchmark.c:34:
vec234.h:53:17: error: duplicate member ‘x’
vec234.h:53:28: error: duplicate member ‘y’
vec234.h:97:15: error: duplicate member ‘x’
vec234.h:97:24: error: duplicate member ‘y’
make: *** [demo-benchmark.o] Error 1
$

Anonymous union is not supported by gcc. I tried also adding the
switch
"-fms-extensions" but it doesn't help:

$ gcc -c -fms-extensions -Wall `freetype-config --cflags` -I/usr/X11/
include -g -O0 demo-benchmark.c -o demo-benchmark.o

I'm running on Ubuntu 11.10 amd 64, my gcc is:
$ gcc --version
gcc-4.6.real (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1



To fix this mean naming union and this will impact other .c file
that depend on vec234.h.


Should I file an "Issues"?


Thanks,

Sylvain.

Nicolas Rougier

unread,
Jan 18, 2012, 10:08:17 AM1/18/12
to freet...@googlegroups.com

Hi Sylvain,

Thanks for the report. I think we might solve the issue by renaming the second x/y couple by omething ike x_/y_:

typedef union
{
float data[4];
float xyzw[4];
float rgba[4];
float rgb[3];
float xyz[3];
struct { float x; float y; float z; float w; };
struct { float x_; float y_; float width; float height; };
struct { float r; float g; float b; float a; };
struct { float red; float green; float blue; float alpha; };
} vec4;

Could you try and tell me if it's working ?

Nicolas

sduclos

unread,
Jan 18, 2012, 10:31:28 AM1/18/12
to freet...@googlegroups.com
Hi

> Could you try and tell me if it's working ?

Yes, that work!

And, this way, those modifications don't impact other file.


Thanks,

Sylvain.

Reply all
Reply to author
Forward
0 new messages