Compiling a mixed D and C++ project?

Gregor Mückl gregormueckl at
Mon Sep 2 15:58:12 UTC 2019

On Monday, 2 September 2019 at 14:20:32 UTC, Kyle De'Vir wrote:
> On Monday, 2 September 2019 at 14:04:44 UTC, Exil wrote:
>> You have to link to Qt's libs when you are compiling your D 
>> code. Otherwise it won't know where to find those functions.
> Ah. Right. How could I forget. :P
> This helped silence the error: `gdc Main.d TestApplication.o 
> -lstdc++ -lQt5Core -lQt5Widgets`
> Anyways, now I have other errors:
> `SetAppAtrributes` is properly wrapped, so I'm unsure about 
> that.
> The other ones I'm not sure what to do about.

Do you compile in the moc-generated code for TestApplication?

"undefined reference to vtable" is a stupid gcc quirk. It only 
emits the vtable for a C++ class under certain circumstances. I 
think it puts it in the object file for the source file that has 
the implementation of the first virtual method in the class 
definition.  If TestApplication is derived from QObject and uses 
the Q_OBJECT macro, then this virtual method is one that is 
created by moc for signal/slot handling.

More information about the Digitalmars-d mailing list