July 8, 2011

Vijaeendra Vijaeendra
Lab Rat
63 posts

[Solved]Adding QWT Library to Qt creator

Page  
1

Hi. Can someone explain me how to add the QWT Library to the Qt creator, so tht i can build plotting application like any other normal applications.

Thank you.

23 replies

July 8, 2011

Denis Kormalev Denis Kormalev
Lab Rat
1654 posts

What do you mean by “adding to Qt Creator”? It is IDE. Maybe you want to add it to your project?

July 8, 2011

Vijaeendra Vijaeendra
Lab Rat
63 posts

Yeah.. Adding it to my project.

July 8, 2011

Denis Kormalev Denis Kormalev
Lab Rat
1654 posts

Look at qmake LIBS keyword in Assistant.

July 8, 2011

dialingo dialingo
Lab Rat
158 posts

Creator even has an assistant for adding libraries.
Open your .pro file and right click into the .pro file.
Now you will see an “add library” item in the context menu.

July 11, 2011

Vijaeendra Vijaeendra
Lab Rat
63 posts

I m working on linux platform. All I have is the .so files and all the header/class files. How to link it to the Qt creator project.

I dont seem to have an add library option on right clicking my .pro file. Rather, I jus have an option to add some random files(C++ class , Resource file and the QML file).

Is Qmake option similar to “ LIBS += -L/usr/local/lib -lmath” ??

Please help.

July 11, 2011

1+1=2 1+1=2
Ant Farmer
316 posts

Vijaeendra wrote:

Is Qmake option similar to “ LIBS += -L/usr/local/lib -lmath” ??


yeah, you are right.

July 11, 2011

Vijaeendra Vijaeendra
Lab Rat
63 posts

I m facing a trouble at the linking phase. I have added a DEPENDPATH to my library file.., the .so file names are as follows..,

libqwt.so
libqwt.so.6
libqwt.so.6.0
libqwt.so.6.0.0
libqwtmathml.so
libqwtmathml.so.6
libqwtmathml.so.6.0
libqwtmathml.so.6.0.0

I tried
LIBS += -llibqwtmathml, which is not working.

I also tried giving the complete path but did not help.
Can u please help me in adding this .,

July 11, 2011

Vijaeendra Vijaeendra
Lab Rat
63 posts

My .pro file is

QT += core gui

LIBS += -llibqwt\ -llibqwtmathml

TARGET = plottrial
TEMPLATE = app

SOURCES += main.cpp\ plotmatrix.cpp

HEADERS += plotmatrix.h

INCLUDEPATH += /home/viju/Desktop/qwt-6.0.0/src

DEPENDPATH += /home/viju/Desktop/qwt-6.0.0/lib

FORMS += plotmatrix.ui

July 11, 2011

Vijaeendra Vijaeendra
Lab Rat
63 posts

Well, It should be

LIBS += -L//home/viju/Desktop/qwt-6.0.0/lib -lqwt

But I still have dynamic linking problem.

July 11, 2011

Eddy Eddy
Gene Splicer
1296 posts

I m working on linux platform. All I have is the .so files and all the header/class files. How to link it to the Qt creator project.

What Linux are you on and what version? This can be important to know because not all linux boxes use the same way to let the run-time linker known the path to a shared library .

 Signature 

Qt Certified Specialist
Qt Ambassador

July 11, 2011

Vijaeendra Vijaeendra
Lab Rat
63 posts

Ubuntu-10.10

thanks

July 11, 2011

Eddy Eddy
Gene Splicer
1296 posts

In that case I think i can help you out. I’ve succeeded using QWT in kubuntu 10.10 and had to look at the ubuntu help pages to solve it out. So it should work for you too.

of course you have to adapt the paths.

in shell :
1. Add the ld.so configuration file :
echo “/usr/local/qwt-6.0.0-rc5/lib” | sudo tee /etc/ld.so.conf.d/qwt.conf
2. Update the cache :
sudo ldconfig -v

put this in your pro file :

  1. #QWT
  2.  
  3. QWT_LOCATION = /usr/local/qwt-6.0.0-rc5/
  4.  
  5. INCLUDEPATH +=  $${QWT_LOCATION}/include/
  6. LIBS =          -L$${QWT_LOCATION}/lib \
  7.                 -lqwt

If you later decide to “uninstall” the libraries, just remove the conf file and run sudo ldconfig again.

 Signature 

Qt Certified Specialist
Qt Ambassador

July 12, 2011

Vijaeendra Vijaeendra
Lab Rat
63 posts

Can u please explain the command . I have qwt folder on the desktop. also there isnt qwt.conf file.
I m not able to edit any of the configuration files. But, I m sure once i add this path it ll surely work.

Thanks.

July 12, 2011

Eddy Eddy
Gene Splicer
1296 posts

Did you compile qwt?

If not open the pro file in Qt Creator and compile it.

Then follow my instructions.

 Signature 

Qt Certified Specialist
Qt Ambassador

July 12, 2011

Vijaeendra Vijaeendra
Lab Rat
63 posts

I have compiled Qwt, I m able to run all the qwt example projects too. But i cant find qwt.conf file.

I need to know the exact procedure for gaining rights to edit the configuration files.

Page  
1

  ‹‹ Linking doesn’t work after upgrade to SDK 1.1.2      gdb crashes after updating to Qt Creator 2.2.1 ››

You must log in to post a reply. Not a member yet? Register here!