[SOLVED] Qt Creator Widget plugin: strange linker error
-
[quote author="mkuettler" date="1337357139"]
Do you link to the correct files?[/quote]Yes I think I'm linking corerctly. I do this:
make project
Close Qt Creator
sudo make uninstall && sudo make install
Copy header files to /usr/include/agt
And in .pro file of application:
@
LIBS += -lagtplugin
INCLUDEPATH += /usr/include/agt
@ -
Sorry, I didn't see your last post when I wrote mine. From what you write I can't tell if everything is correct, but it looks good to me. Still, the error message means that the linker cannot find the implementation of the constructor, and I assume the file is not visible to the linker. I cannot think of an other reason.
-
[quote author="soroush" date="1337357660"]
And in .pro file of application:
@
LIBS += -lagtplugin
INCLUDEPATH += /usr/include/agt
@[/quote]I do not understand one thing: why do you need link to the "agtplugin"? It's really a plugin like your said in the thread title?
-
[quote author="1+1=2" date="1337358491"]
[quote author="soroush" date="1337357660"]
And in .pro file of application:
@
LIBS += -lagtplugin
INCLUDEPATH += /usr/include/agt
@[/quote]I do not understand one thing: why do you need link to the "agtplugin"? It's really a plugin like your said in the thread title?[/quote]
Its a widget library. I removed LIBS += -lagtplugin and got 8 linker errors (for all 8 widgets I put on my main window)
-
Oh, I see, what you really mean is a normal shared library instead of a plugin.
If I am right. what you are doing is:
- Changed source code of a library(By adding a new class)
- Rebuild the library
- Install it (Wait... In which place you install it ?)
- Copy header files (Doesn't this done in last step?)
- Using your library by LIBS and INCLUDEPATH (Wait... are your sure LIBS += -lagtplugin linked to your new build library?)
By the way, whether the QtCreator generated code inherit from Ui::<widget_name> or not depends on youself. Please go to "Tools/Options/Designer/..."
Debao
-
[quote author="1+1=2" date="1337366955"]
By the way, whether the QtCreator generated code inherit from Ui::<widget_name> or not depends on youself. Please go to "Tools/Options/Designer/..."
[/quote]Oh! Thank you! I didn't know that :)
bq. Install it (Wait… In which place you install it ?)
Makefile installs it on /usr/lib/x86_64-linux-gnu/qt4/plugins/designer/libagtplugin.so . After sudo make install I can see widgets in Qt Creator.
bq. Copy header files (Doesn’t this done in last step?)
I think it's not done by build system. I have to copy headers in /usr/include or somewhere else and let other projects know about their location. Am I doing it wrong?
bq. are your sure LIBS += -lagtplugin linked to your new build library?
Removing library by sudo make uninstall. Output is like:
rm -f "/usr/lib/x86_64-linux-gnu/qt4/plugins/designer/libagtplugin.so"
So I can say, yes I'm sure. -
;-( I am really confused by what you are doing now.
bq. Makefile installs it on /usr/lib/x86_64-linux-gnu/qt4/plugins/designer/libagtplugin.so . After sudo make install I can see widgets in Qt Creator.
Ok, you really build a plugin for designer. but this plugin doesn't intent to be used by application.
Though you can use it as a normal shared library in your application if you export symbols properly, but it is not encouraged.
Normally, you need to build a shared library, which can be used by your application, or optionally by your designer plugin.
bq. I think it’s not done by build system. I have to copy headers in /usr/include or somewhere else and let other projects know about their location. Am I doing it wrong?
Which files need to be installed, and where to install them , all controlled by yourself. look your xxx.pro files carefully if it is not written by yourself manually.
bq. Removing library by sudo make uninstall. Output is like:
rm -f “/usr/lib/x86_64-linux-gnu/qt4/plugins/designer/libagtplugin.so”
So I can say, yes I’m sure.No, You still don't give evidence that this is the library to be linked by your linker.
-
[quote author="1+1=2" date="1337370924"]
No, You still don't give evidence that this is the library to be linked by your linker.[/quote]This is a part of output of ldd ./cards-report (the application that uses widget library)
@
....
/usr/lib/x86_64-linux-gnu/qt4/plugins/designer/libagtplugin.so (0x00007f0b17c0d000)
....
@