PDA

View Full Version : QTCreator does not see qwt library



leinad
1st October 2020, 17:40
Hi,

It seems I'm having an issue with running qwt under Qt Creator on a MAC. It works fine on Windows and CentOS.

I installed and built qwt on my MAC as per the instructions on the qwt website.

The library is installed in /usr/local/qwt-6.1.5/plugins/designer an the library name is libqwt_designer_plugin.dylib

in the project file I reference this library as I do with any other but for some reason I keep getting the error: library not found -llibrary_designer_plugin, linker command failed with exit code 1 (use -v to see invocation). Here are parts of the project file which references the qwt library.

---------------
QT += core gui
CONFIG += qwt

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = MyAppName
TEMPLATE = app

Sources += \
whole bunch of sources

HEADERS += \
whole bunch of .h files

FORMS += \
mainwindow.ui

QWT_LIB_PATH = /usr/local/qwt-6.1.5/plugins/designer
QWT_SRC_PATH = /Users/Myname/Qt/qwt-6.1.5
PLATFORM = macos1014-clang100
QWT_LIB = libqwt_designer_plugin


INCLUDEPATH += Bunch of sources \
$${QWT_SRC_PATH}/src

LIBS += -L$$(bunch of other libs path} \
-lsomeLibs \
-L$${QWT_LIB_PATH} \
-l$${QWT_LIB}


---------------------------
Not sure what I can be doing wrong, this should be straight forward. Any help would be appreciated.
I'm running on Catalina 10.15.7

Thanks in advance!

ChristianEhrlicher
1st October 2020, 19:28
You have to remote the lib prefix from the library name - it has to be '-lqwt_designer_plugin'

leinad
1st October 2020, 19:47
Yes I did that see:
-l$${QWT_LIB}

I also tried hard coded as you mentioned no variable '-lqwt_designer_plugin' still the same issue.

ChristianEhrlicher
2nd October 2020, 15:39
Apart from this - a plugin doesn't need to be linked at all. It's dynamically loaded at runtime by the designer so the qwt widgets are shown up there, nothing more.

d_stranz
2nd October 2020, 16:29
Aside from the errors in specifying the name of the library (and your .pro file should read like this):



QWT_LIB = qwt_designer_plugin


why are you linking to the Qt Designer plugin when you are creating a standalone app? The plugin is for use by Qt Designer to make Qwt widgets visible in the Designer so you can add them to a GUI.

When you are building an app, you link to the Qwt library itself, not the designer library.



QWT_LIB = qwt

leinad
5th October 2020, 15:27
Okay, thanks. I'll correct and hopefully have no issues.

leinad
6th October 2020, 17:37
Since I can let qtCreator link qwt directly I kept the first line CONFIG += qwt and removed all instances of qwt lib, but now I get:
undefined symbols for architecture x86_64
linker command failed.

I didn't have this before using qwt so it must be related. Any ideas?

Thanks.

Added after 5 minutes:

Indeed it is related to qwt clicking on the above error shows all references to qwt.

On another note, I can't find the qwt library on MAC. Can easily be found on windows and CentOS. Where would I find it?

d_stranz
6th October 2020, 20:26
undefined symbols for architecture x86_64
Indeed it is related to qwt clicking on the above error shows all references to qwt.


If this is Windows, libraries built for 32- and 64-bit architectures are not compatible. It looks like you are trying to link a 32-bit library with a 64-bit app.



On another note, I can't find the qwt library on MAC. Can easily be found on windows and CentOS. Where would I find it?


You probably have to build it from sources. It is not part of a Qt distribution and I don't know if Uwe supplies a pre-built binary for the MacOS platform.

leinad
6th October 2020, 21:00
This is for MAC. I already built from source by following the user guide instructions, that is how I got the qwt_designer_plugin library. I would have expected it would build the qwt lib as well but it did not. It does for Windows and CentOS. I'm not a MAC expert which is why I'm asking. Is there something more I need to do besides qmake qwt.pro, make, and make install?

d_stranz
7th October 2020, 16:37
Is there something more I need to do besides qmake qwt.pro, make, and make install?

Surprising that it doesn't also build qwt itself. I would think that the plugin requires it, but maybe not. My guess is your steps are probably all that is required. Is there any info on the Qwt project page or in the docs?

leinad
7th October 2020, 18:47
That's all I can find. This is weird. It works fine on CentOS and Windows so I am at a loss. There is very little information regarding this problem. If there was something special I need to do, I wish the documentation would specify it.

leinad
13th October 2020, 14:16
Any ideas please?

d_stranz
13th October 2020, 19:54
There is a Qwt-specific section of this forum (under Qt Programming). Ask your question there and Uwe will almost certainly respond.

leinad
14th October 2020, 16:41
Okay, I'll try that and close this thread.