i have built the dll its QtSolutions_SOAP-2.7d.dll and now i want to reference that in Qt Creator how do i do that ?
thanks
In the QtSolutions package you also have an examples directory with several examples.
Basically you just have to include src/qtsoap.pri in the .pro file of your project.
And the dll should be in your PATH.
Related
I'm developing a simple Qt GUI application in Windows. The application itself has to open shapefile file type, and lurking around the internet, I've found two possible candidate libraries:
shapelib C library
GDAL C++ Library
The problem I'm facing is that I can't make them to work in Qt, no matter what. I was more keen on using shapelib because of its smaller size, but in the end I only need something that works.
The steps I've done so far were:
set up the main project, fine
create a library project in Qt, add the source code for shapelib (build with cmake), fine, it builds without errors in Qt
flag, in main project, the "shapelib" project as a dependency for main project
add shapelib to .pro via SUBDIRS
If I try to include the main header from shapelib (shapefil.h), Qt gives "File not found" error and I can't work.
I'm not a Windows user, and quite new to Qt, I've read some of the documentation regarding how to add libraries on Qt website, but I'm more confused now than before.
Could you help me resolve this issue?
Thank you!
I am trying to use a library to generate barcode images inside a Qt/C++ app.
I've been looking at ZINT and ZXING, but I don't understand how would I use them inside my code.
If I download and compile the library, how do I call it afterwards? Could I set up the Qt makefile to compile it for the desired platform?
Thanks, and sorry for the broad question, I'm not very experienced in C++ projects.
In QT you usually include 3rd party libraries through the .pro file. Use the LIBS variable to tell QT where to find it.
Example lines from the QT docs:
TARGET = MyQtApp
TEMPLATE = app
INCLUDEPATH += 3rdparty/CatWhisperer/include
SOURCES += src/main.cpp
LIBS += -L"3rdparty/CatWhisperer/lib" -lCatWhisperer
If you're using Qt Creator, you can add libraries to your .pro by using a wizard provided by the IDE. Right-click your project in the project browser, click Add library... and, then, follow the wizard.
More details here: http://doc.qt.io/qtcreator/creator-project-qmake-libraries.html
I have been trying to play a simple audio file using:
http://qt-project.org/doc/qt-5/qmediaplayer.html and
http://qt-project.org/doc/qt-5/QSound.html
I am using Qt 5.3 but the problem is, when I type #include QMediaPlayer or QSound, QtCreator keeps underlining them with red because it can't find them. The thing is, the files are there. They are located in QtMultimedia/ and I have seen them. When I try to prefix QtMultimedia/QMediaPlayer or QtMultimedia/qmediaplayer.h it still can't find them.
If I type #include "QtMultimedia/" the auto-complete drop down in the text editor only shows QtMultimedia/QtMultimediaDepends. Normally you get a list of all the files in the folder but not with this one.
Looks like there is something wrong with the paths. How do I fix them? I am using a Windows machine.
Edit: I have included project settings - see screenshots.
I think, after you modified your .pro file, You didn't run the qmake.
build-> run qmake
qmake will generate the makefile you need to build the src code.
if you only change the .pro file, but didn't run it. Nothing is changed.
and that is reason, you create a new project and it is working.
Ok I figured it out. It's a problem with my Qt version.
My Qt 5.3 version is a custom compiled one. When I select the included version that came with the installer, QSound is found. When I change the kit to the custom compiled one, the file cannot be found. I must have forgotten to include some sort of multimedia option to the configure script during compilation.
Now the question is what is the missing option, I will need to do more reading...
Of course, comments and suggestions are welcome :)
You have to add the word 'multimedia' in your .pro file:
QT += core GUI
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets multimedia
I am new to QT Creator coming from Visual Studio. I have a session with two projects in it. One is a DLL with some classes that I intend to use for other purposes. The other is an executable console app that uses some of the classes from the DLL.
I currently have these two projects side by side in QT Creator. I can include the header files from the DLL in my EXE project using relative paths "../MyPrject/header.h". But how do I get QT Creator to link and then copy the DLL into the executable debug folder for debugging.
Am I doing this all wrong? Is there a better way? If it includes adding code to the .pro file, please include a link so that I can learn more.
You should make some dependencies between this projects.
opening both projects - you have done.
on editor view, right click on exe-project and select add library...
follow creator hints to add it.
2nd option: you can make subprojects. follow QtCreator: Creating Projects from documentation (help view in Qt Creator)
GwyenBleidD provided a good starting point for including DLLs.
I however, have made a habit out of modifying the .pro file directly here and honestly I prefer to modify the .pro file in the event that something goes haywire.
Suppose I wanted to use the winsock DLL.
In the .pro file, I'd first specify the .dll's corresponding .lib file:
# WinSock2 library (ws2_32.lib file)
LIBS += -lws2_32
# Path to the WinSock2 library
LIBS += -L"c:/mylibraries/"
Additionally, you'll need to specify the include path to the header files here:
INCLUDEPATH += "c:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/INCLUDE"
Thirdly, in my code I'd have to make sure to include the headers for it:
// I ASSUME it'll be found under something like the
// Visual Studio/VC/INCLUDE directory mentioned above.
#include <winsock2.h>
Lastly, you need to ensure that your application can find the .dll file, typically pointed to using the %PATH% environment variable.
With regards to your setup, I'd make sure that your sub-projects are configured so that the library compiles FIRST (obviously). And then ensure that the LIBS variable in your .Pro project points correctly to your .lib destination according to the build configuration (debug|release).
Qt's PRO (qmake) isn't as terrible as some make it out to be. Just give it a solid half-hour to an hour and you'll get the hang of it. I assume though that you have a solid understanding of libs and DLLs and what not.
http://qt-project.org/doc/qt-5.0/qtdoc/qmake-manual.html
The right way is to switch on CMake based project and keep exe and dll within one root project. The main benefit of this decision is IDE independent approach: you can use Qt Creator, CLion, Visual Studio without any changes in project definition. As the start point consider to see the example project https://github.com/anatoly-spb/cmake_exe_dll
I want to create a similar GUI as Qt Creator main layout and thus I am looking for Qt Creator Source files.
Can anyone direct me from where to download.
Have a look at the gitorious repo: http://qt.gitorious.org/qt-creator