Help with undefined reference in Windows with mingw32
Hi,
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:
Code:
QT += core gui sql
CONFIG += designer plugin debug_and_release
TARGET = $$qtLibraryTarget(impwidgetsplugin)
TEMPLATE = lib
....
This generate 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:
Code:
QT += core gui sql svg
TARGET = $$qtLibraryTarget(impmainmodules)
TEMPLATE = lib
CONFIG += plugin
win32:LIBS += c:\ilri\crossimpact\libimpwidgetsplugin.a
....
The problem is that I always get:
Code:
.
/debug\plots.
o:C
:\ilri\crossimpact\plugins\syschar\impmainmodules
/modules
/plots.
cpp:203: undefined reference to `impgenmaint
::insertKeyField(QString,
QVariant,
bool)'
Here, impgenmaint::insertKeyField(QString, QVariant, bool) is defined in the designer plugin impwidgetsplugin.dll
I can see that mingw32 is apparently using the library:
Code:
mingw32-make[1]: Entering directory `C:/ilri/crossimpact/plugins/syschar/impmainmodules'
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -shared -Wl,--out-implib,..\..\..\libimpmainmodules.a -o ..\..\..\impmainmodules.dll object_script.impmainmodules.Debug -L"c:\Qt\2010.03\qt\lib" c:\ilri\crossimpact\libimpwidgetsplugin.a -lQtSvgd4 -lQtSqld4 -lQtGuid4 -lQtCored4
Any idea how I need to configure the PRO so it properly links it?
Many thanks for any help.
Carlos.
Re: Help with undefined reference in Windows with mingw32
Try
Code:
win32:LIBS += -Lc:/ilri/crossimpact -limpwidgetsplugin
Re: Help with undefined reference in Windows with mingw32
Hi,
Thanks for your reply.
I tried that and still does not work.
I also try to build both libraries on release but I get the same result :(
This is the first error:
Code:
.
/release\plots.
o:plots.
cpp:(.
text+0x13f5
): undefined reference to `calcDialog
::calcDialog(QWidget*)'
Indeed the code in plots.cpp uses calcDialog like:
Code:
#include <calcdialog.h>
....
calcDialog calc;
calc.setDatabase(dataBase);
calc.setCurrentDisplay(index.data().toFloat());
calc.exec();
....
In the PRO I have the include path of calculator:
Code:
INCLUDEPATH += ../../../plugins/interfaces ../../designer/impwidgets ../../designer/impwidgets/widgets/calculator
So, I really don't know what is wrong because in Linux it works ok with:
Code:
unix:LIBS += -L/home/cquiros/data/projects/tools/crossimpact -limpwidgetsplugin
Many thanks,
Carlos.
Re: Help with undefined reference in Windows with mingw32
Post content of both pro files, maybe there's a problem you're missing.
Re: Help with undefined reference in Windows with mingw32
I fixed!
I had to put Q_DECL_EXPORT and Q_DECL_IMPORT in the library + DEFINES in the pro.
http://qt-project.org/doc/qt-4.8/sharedlibrary.html
Thanks.