I'm trying to compile a simple program using the GeoIP2 lite API. I've compiled the GeoIP Lite program and it created the library files. The .la file is in /mydir/libmaxminddb-0.5.3/src
I modified my .pro file to include:
LIBS += /mydir/libmaxminddb-0.5.3 -lmaxminddb
but when I compile my project errors with "Cannot find -lmaxminddb"
Can someone tell me what's wrong? I've tried changing directories, adding a "lib" prefix to the maxminddb, and more, but I can't figure it out.
(I'm trying to link against libmaxminddb.a which is pointed to by libmaxminddb.la)
I believe in autoconf and friends the -l flags go in the LDFLAGS variabe, not LIBS.
I found elsewhere that with Qt Creator you can right click the project and add an external library. When I do so, I see the .pro file adds:
LIBS
INCLUDEPATH
DEPENDPATH
So that's what you need to add!
That should be LIBS += -L/mydir/libmaxminddb-0.5.3 -lmaxminddb. Note the extra -L in front of the directory name.
Related
I am trying to make a simple qt c++ VoIP application, when I searched I found the QtGStreamer Lib and wanted to make it work. I download the latest version 1.2 from here.When I went to the example folder and tried to compile the VoIP example I got this error:
Qt5GStreamer-1.0 development package not found
What I try is comment this line CONFIG += link_pkgconfig in .pro file and add the src folder that came with the folder of QtGstreamer to folder project. I also added this to .pro file INCLUDEPATH += $$PWD/src this the path of the Libs folder
Now I get an error that i need to add boost Lib so I add it by adding this to .pro file
INCLUDEPATH += C:/boost_1_61_0
LIBS += "-LC:/boost_1_61_0/stage/lib"
Now I get many errors that say (undefined reference to ..) 130 error. Not sure what to try.
the file comes with containing Readme file I download the dependency but the same error I think the problem that I don't link it correctly I'm still a beginner in 3rd party and link libs in c++,
my os is windows
Thanks in advance
I need the boost library for a project on my Raspberry Pi 2. I use QTCreator for coding but I cant add the Library. I tried to add this to the .pro file of my project in QTCreator:
LIBS += -L/usr/include/boost -lboost_chrono
I installed the boost Library using:
sudo apt-get install libboost1.55-all
If I try to compile my code I get the "boost/chrono.hpp no such file or directory".
I read somewhere that I have to compile the Library first using the same compiler as QtCreator (usually mingw) but I have no clue how to do that.(Im a beginner with the raspberry and the linux system in general)
Thx for your help
LIBS += -L
This adds a path to the linker. Your error is related to a path in the include. You should add the boost path via
INCLUDEPATH +=
As mentioned here: How to add include path in Qt Creator?
I'm trying to install libusb (not libusb-win32) on windows 7. I have to link it with Qt 5.0.1. Here are the problems I'm facing
In the INSTALL file in the extracted libusb folder, it tells me to cd to the current folder then run
./configure
make
makeinstall
But I got the error
'./configure' is not recognized as a valid command.
Googling this problem usually gives the solution as installing libusb-win32. However, I want to avoid that, as of now.
In the libusb library, there were a few MSVC projects, so I built them. That did generated some .lib files. So I proceeded to link them with my Qt project. It recognizes the libusb.h header file but does not link properly. Here is my .pro file
QT += core gui widgets
TARGET = Qt_libusb TEMPLATE = app
SOURCES += main.cpp\
qt_libusb.cpp
HEADERS += qt_libusb.h
FORMS += qt_libusb.ui
LIBS += -LC:\libusb-1.0.18\Win32\Debug\lib\libusb-1.0
INCLUDEPATH += C:/libusb-1.0.18/libusb DEPENDPATH += C:/libusb-1.0.18/libusb
My objective is to link the libusb library with Qt. Please tell me if I haven't 'installed' the library correctly or if I am linking it in a wrong way. thanks
Your project file does not reference the library. You only provide a path where libraries might be found, but there's no reference to the libusb library itself.
What you're missing is something like
LIBS += -llibusb
You also can't have multiple project file statements on the same line. The below is an error:
TARGET = Qt_libusb TEMPLATE = app
It should look like:
TARGET = Qt_libusb
TEMPLATE = app
I have many problems with Taglib, Qt and MSVC2012
First, I compiled zlib with the cmake-gui and MSVC2012
Then, I compiled taglib with the cmake-gui and MSVC2012
After that, I opened up the .sln file in Visual Studio 2012,
then I built taglib. I got a .dll, a .lib and a .exp file. Everything good.
Then I made the following folder-structure in my Program-Folder:
My Program name is "MyM"
./MyM/taglib with all the folders inside (ape, asf, toolkit etc.)
./MyM here I have my tag.dll, my tag.lib and the "config.h" and the "taglib_config.h".
Then, in the .pro file, I added the following lines:
win32: LIBS += -L$$PWD/ -ltag
INCLUDEPATH += $$PWD/taglib
DEPENDPATH += $$PWD/taglib
So, I built the program and it says
"tstring.h": No such file or directory
So I searched in Google for this error and I found out that I can add every folder to the INCLUDEPATH. So I did this
INCLUDEPATH += $$PWD/taglib/ape
INCLUDEPATH += $$PWD/taglib/asf
INCLUDEPATH += ...
...and so on
So, build again -> everything good!
Then I clicked the "Run"-Button and the program crashes. I don't know why and yeah. Please help me
Thank you for reading :)
Just resolved the same issue after struggling a little.
The taglib requires the zlib. Nothing is said about it in documentation except at the cmake stage. So if you didn't linked it here then it's quite hard to guess the cause.
Link the zlib in your .pro and it won't crash anymore.
I want to use an older code-fragment in my Qt-project, which is using WinSocks.
I created my program with Qt Creator and I don't know, how I can link to the ws2_32-Library. I already added LIBS += -lws2_32 to my .pro, but nothing happened. So how can I link to this library?
edit: Where can I find the ws2_32.lib to include it? Do I have to download it first? I know it comes with "Visual Studio", but I don't use it and I don't want to use it.
ok, when you know it, it's really simple.The Qt-SDK comes with a WinSock2-Library, called libws2_32.a.The only thing you have to
do, is to enter this line in your .pro:
LIBS += C:\Qt\2009.04\mingw\lib\libws2_32.a
this includes the winsock2-library to your project and you have nothing else to do.
You may do this slightly more simply by using this line in your .pro:
LIBS += -lws2_32
You are supposed to use the full or relative path (depends on what library paths you have in your enviroment) to the .libs.
From the qmake manual:
win32:LIBS += c:/mylibs/math.lib
You need too to add the path to the headers in order to add the function's signatures of a dynamic library.
Use the INCLUDEPATH variable into the .pro file.
I have ws2_32.lib in c:\Program Files\Microsoft SDK\Lib\WS2_32.Lib it comes with the platform sdk. I have a very old version from Feb 2003 I think, I only needed it when I was using VC6.0, but I assume it is in the latest version too.