QLands
QLands

Reputation: 2586

Undefined reference in Windows with QT, QTcreator and mingw32

I'm getting undefined reference when I build an application in Windows witn mingw32 (it does not happen in Linux). The application is divided in two parts:

1- A set of designer plugins with the PRO like:

QT += core gui sql

CONFIG += designer plugin debug_and_release

TARGET = $$qtLibraryTarget(impwidgetsplugin)

TEMPLATE = lib

This generates the files: libimpwidgetsplugin.a and impwidgetsplugin.dll in c:\ilri\crossimpact\

2- A set of plugins in a library that requires impwidgetsplugin with the PRO like:

QT += core gui sql svg

TARGET = $$qtLibraryTarget(impmainmodules) TEMPLATE = lib CONFIG += plugin

win32:LIBS += -Lc:/ilri/crossimpact -limpwidgetsplugin

....

The problem is that I always get:

./release\plots.o:plots.cpp:(.text+0x13f5): undefined reference to `calcDialog::calcDialog(QWidget*)'

calcDialog is defined in impwidgetsplugin.

i can see the make parameters have that required library limpwidgetsplugin:

g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -mthreads -Wl -shared -Wl,--out-implib,..\..\..\libimpmainmodules.a -o ..\..\..\impmainmodules.dll object_script.impmainmodules.Release -L"c:\Qt\2010.03\qt\lib" -Lc:/ilri/crossimpact -limpwidgetsplugin -lQtSvg4 -lQtSql4 -lQtGui4 -lQtCore4

Any idea how I need to configure the PRO so it properly links it?

Many thanks for any help. Carlos.

Upvotes: 1

Views: 983

Answers (1)

alexisdm
alexisdm

Reputation: 29896

You can have almost the same behavior as linux, by using LIBS+=-Wl,-export-all-symbols in the plugin .pro file.

But it looks like you didn't export the class properly with the macros Q_DECL_EXPORT and Q_DECL_IMPORT.

Upvotes: 1

Related Questions