Trying to link to Qt 5 on dmd 2.068.0~beta1

John Colvin via Digitalmars-d digitalmars-d at puremagic.com
Mon Jul 20 10:20:52 PDT 2015


On Monday, 20 July 2015 at 16:03:03 UTC, Shriramana Sharma wrote:
> Trying to compile the attached program to test DMD 2.068's 
> promised C++ interfacing capabilities:
>
> $ dmd qt.d -L-L/usr/share/x86_64-linux-gnu -L-lQt5Core 
> -L-lQt5Gui
> qt.o:(.rodata+0x40): undefined reference to `QWidget::show()'
> qt.o: In function `_Dmain':
> qt.d:(.text._Dmain+0x3b): undefined reference to
> `QApplication::__ctor(int&, char**)'
> qt.d:(.text._Dmain+0x4f): undefined reference to 
> `QApplication::exec()'
> collect2: error: ld returned 1 exit status
> --- errorlevel 1
>
> Seems like I'm doing something hopelessly wrong. Please 
> enlighten. Also, please specifically review my hastily 
> put-together argv(string[] args) function...
>
> I'm using Kubuntu Trusty 64 bit.

I don't know much about the C++ interface but Qt is a massive, 
complicated library. Have you tried some simple examples with C++ 
code you've written yourself?

Just guessing here, but those class definitions don't inherit 
from anything (e.g. QApplication should perhaps inherit from 
QGUIApplication which inherits from QCoreApplication which 
inherits from QObject) so maybe that is a problem? Also exec is a 
static member function.


More information about the Digitalmars-d mailing list