I have the following struct with i compile with -betterC into a static library.
struct SubmitDesc {
union {
uint[4] viewport;
struct {
uint vpx;
uint vpy;
uint vpw;
uint vph;
}
}
union {
float[4] clearColors;
struct {
float[4] clearColor0;
// float[4] clearColor1;
// float[4] clearColor2;
// float[4] clearColor3;
}
}
bool clearColorBuffer;
bool clearDepthBuffer;
}
I compile another binary which dub does all automatically which is not -betterC where I try to use my static library and the strcut but I get a linker error all the time (Below.
Can somebody point me what I'm missing ?
Of course when I compile everything without -betterC it works just fine. Is the -betterC config not creating the equals, hash functions which are generated by D ?
struct DrawPass {
CommandList* commands;
SubmitDesc submitDesc;
}
DrawPass mPassOpaque;
error: /usr/bin/ld: build/.objs/examples/linux/x86_64/debug/source/examples/example.d.o:(.data._D46TypeInfo_S3leo11graphicsapi6common10SubmitDesc6__initZ+0x30): undefined reference to leo.graphicsapi.common.SubmitDesc.__xtoHash(ref const(leo.graphicsapi.common.SubmitDesc))' /usr/bin/ld: build/.objs/examples/linux/x86_64/debug/source/examples/example.d.o:(.data._D46TypeInfo_S3leo11graphicsapi6common10SubmitDesc6__initZ+0x38): undefined reference to
leo.graphicsapi.common.SubmitDesc.__xopEquals(ref const(leo.graphicsapi.common.SubmitDesc)) const'
collect2: error: ld returned 1 exit status
Error: undefined reference to leo.graphicsapi.common.SubmitDesc.__xtoHash(ref const(leo.graphicsapi.common.SubmitDesc))
Error: undefined reference to leo.graphicsapi.common.SubmitDesc.__xopEquals(ref const(leo.graphicsapi.common.SubmitDesc)) const
perhaps a library needs to be added with the -L
flag or pragma(lib, ...)
Error: linker exited with status 1
cc build/.objs/examples/linux/x86_64/debug/source/examples/example.d.o build/.objs/examples/linux/x86_64/debug/source/examples/graphicsapi/ex0_clear_background.d.o build/.objs/examples/linux/x86_64/debug/source/examples/main.d.o build/.objs/examples/linux/x86_64/debug/deps/bindbc-glfw/source/bindbc/glfw/bindstatic.d.o build/.objs/examples/linux/x86_64/debug/deps/bindbc-glfw/source/bindbc/glfw/binddynamic.d.o build/.objs/examples/linux/x86_64/debug/deps/bindbc-glfw/source/bindbc/glfw/package.d.o build/.objs/examples/linux/x86_64/debug/deps/bindbc-glfw/source/bindbc/glfw/types.d.o build/.objs/examples/linux/x86_64/debug/deps/bindbc-loader/source/bindbc/loader/package.d.o build/.objs/examples/linux/x86_64/debug/deps/bindbc-loader/source/bindbc/loader/sharedlib.d.o build/.objs/examples/linux/x86_64/debug/deps/bindbc-loader/source/bindbc/loader/system.d.o build/.objs/examples/linux/x86_64/debug/deps/bindbc-loader/source/bindbc/loader/codegen.d.o -o build/linux/x86_64/debug/examples -m64 -Xlinker --export-dynamic -Lbuild/linux/x86_64/debug -lleo -L/usr/lib -Xlinker -Bstatic -lphobos2 -Xlinker -Bdynamic -lpthread -lm -lrt -ldl