Qt support for HockeySDK - qt

Is there a way to use the HockeySDK within a Qt application? I made a basic test trying to import your framework into my project adding these lines to my profile:
# test.pro
LIBS += -F/Applications/HockeyApp.app/Contents/Frameworks -framework HockeySDK
OBJECTIVE_SOURCES += hockey.m
With the following code:
// hockey.m
#include <HockeySDK/HockeySDK.h>
void hockey() {
[[BITHockeyManager sharedHockeyManager] configureWithIdentifier:#"APP_IDENTIFIER"];
// Do some additional configuration if needed here
[[BITHockeyManager sharedHockeyManager] startManager];
}
But I have the following error:
error: 'HockeySDK/HockeySDK.h' file not found
Any help?

I fixed my problem using the following pro file:
# test.pro
QMAKE_CXXFLAGS += -F/path/to/the/folder/containing/frameworks
QMAKE_OBJECTIVE_CFLAGS += -F/path/to/the/folder/containing/frameworks
LIBS += -F/path/to/the/folder/containing/frameworks
LIBS += -framework HockeySDK
LIBS += -framework Foundation
OBJECTIVE_SOURCES += hockey.m

Related

Why lupdate not include qml qstr string into .ts file?

I have this .pro file :
TEMPLATE = subdirs
SUBDIRS += internal app
app.depends = internal
app.subdir = src/app
internal.subdir = src/internal
TRANSLATIONS = \
$$PWD/translations/croatian.ts \
$$PWD/translations/danish.ts \
$$PWD/translations/english.ts \
$$PWD/translations/french.ts \
$$PWD/translations/german.ts \
$$PWD/translations/italian.ts \
$$PWD/translations/norwegian.ts \
$$PWD/translations/portuguese.ts \
$$PWD/translations/romanian.ts \
$$PWD/translations/spanish.ts
internal.pro is this:
TEMPLATE = lib
TARGET = internal
CONFIG += c++1z
QT += core core-private gui quick serialport sql multimedia
DEFINES += CURRENT_PATH=\\\"$$PWD\\\"
CONFIG(release, debug|release) {
CONFIG += qtquickcompiler
QMAKE_CXXFLAGS += -O3
}
CONFIG(debug, debug|release) {
QMAKE_CXXFLAGS += -O0
QMAKE_CXXFLAGS -= -O1
QMAKE_CXXFLAGS -= -O2
QMAKE_CXXFLAGS -= -O3
QMAKE_CXXFLAGS += --debug
}
#MS_SKELETON_MODULES = core utils network
#include($$PWD/../external/ms-skeleton/ms-skeleton.pri)
include($$PWD/aggiornamento/aggiornamento.pri)
include($$PWD/allarmi/allarmi.pri)
include($$PWD/comunicazione/comunicazione.pri)
include($$PWD/core/core.pri)
include($$PWD/jsoncpp/jsoncpp.pri)
include($$PWD/mqtt/mqtt.pri)
include($$PWD/other/other.pri)
include($$PWD/parametri/parametri.pri)
include($$PWD/programs/programs.pri)
include($$PWD/serializer/serializer.pri)
unix: target.path = /opt/Tagliavini/lib
!isEmpty(target.path): INSTALLS += target
and app.pro is this :
TEMPLATE = app
TARGET = UserInterface
CONFIG += c++1z
QT += core gui quick sql multimedia
DEFINES += CURRENT_PATH=\\\"$$PWD\\\"
CONFIG(release, debug|release) {
CONFIG += qtquickcompiler
QMAKE_CXXFLAGS += -O3
}
CONFIG(debug, debug|release) {
QMAKE_CXXFLAGS += -O0
QMAKE_CXXFLAGS -= -O1
QMAKE_CXXFLAGS -= -O2
QMAKE_CXXFLAGS -= -O3
QMAKE_CXXFLAGS += --debug
}
LIBS += -L$$shadowed($$PWD)/../internal/ -linternal
INCLUDEPATH += \
$$PWD/../internal \
$$PWD/../external/ms-skeleton
SOURCES += $$PWD/main.cpp
RESOURCES += \
$$PWD/../../font/fonts.qrc \
$$PWD/../../images/images.qrc \
$$PWD/qml/qml.qrc \
$$PWD/../../sounds/sounds.qrc
unix: target.path = /opt/Tagliavini/bin
!isEmpty(target.path): INSTALLS += target
when i try to create file .ts with lupdate , the files are generated correctly , but the file .ts not cointeins the qstr strings that are into qml files. ( the file qml are into app.pro ), instead the string that i want to translate into .cpp files are all recognized correctly and put into .ts file.(these are into internal.pro) Where is the problem??
It seems that you are including your .qml files in .qrc resources but not in the project SOURCES itself. lupdate will not pick/parse your .qrc files to list .qml files.
So, you will have to add your .qml files to SOURCES either one-by-one or per directory.
lupdate_only{
SOURCES+=example.qml
SOURCES+=app/FancyControls/*.qml
}
This will duplicate your QML file entries in Qt Creator project pane tree which is not very desirable. So, you can comment out those lines in your .pro file and uncomment it before any lupdate. It's also mandatory to fence those imports in lupdate_only{} conditional statement. Make sure that there is no space between lupdate_only and the curly bracket. Actually, your C/C++ compiler would not expect a qml file to be compiled.

How do I include muparser library in my Qt project?

I made a muparser.pri which had the following content,
macx|win32|equals(build_muparser, "true")|!packagesExist(muparser){
message("Using bundled muparser")
MUPARSER_DIR = src/rel/muparser
DEPENDPATH += $$MUPARSER_DIR/include \
$$MUPARSER_DIR/src
INCLUDEPATH += $$MUPARSER_DIR/include
GEN_LIB_DIR = ../../generated/lib
LIBS += -L$$GEN_LIB_DIR -lmuparser
PRE_TARGETDEPS += $$GEN_LIB_DIR/libmuparser.a
}else{
message("Using external muparser")
CONFIG += link_pkgconfig
PKGCONFIG += muparser
}
I, then, added a
include(./muparser.pri)
in my application's make file.
This gave me an error
":-1: error: No rule to make target '../../generated/lib/libmuparser.a', needed by 'debug/Akaar1.exe'. Stop."
What did I do wrong? How else am I supposed to include this library in my project?
In your .pro file you can do:
LIBS += -L*path to the library* -l*library name: foo for libfoo.a*

Qwt framework not found

Good Morning,
I am currently trying to build a project in QT that uses the Qwt library. However, when I try to build the project I get
warning: directory not found for option '-F/usr/local/qwt-6.1.0/lib'
error:framework not found qwt
error:linker command failed with exit code 1
I have followed the steps in this post as well as this post but it still cannot find the framework
I am using Xcode 6, Qwt 6, QT 5.3, and Mac OSX 10.9.
My .pro file's relevant code is as follows:
#mac: QMAKE_MAC_SDK.macosx.path = Applications/Xcode.app/Contents/Developer/Patforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk
#mac: QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9 #Added to help build QWT
#INCLUDEPATH += /usr/local/qwt-6.1.0/qwt.prf
include (/usr/local/qwt-6.1.0/qwt.prf )
#CONFIG += qwt
#macx:QMAKE_MAC_SDK += macosx10.9
QMAKEFEATURES += /usr/local/qwt-6.1.0/features
CONFIG += qwt
#mac:INCLUDEPATH += /Library/Frameworks/qwt.framework/Headers
#mac: INCLUDEPATH += /usr/local/qwt-6.1.0/src
mac: INCLUDEPATH += /usr/local.qwt-6.1.0/lib/qwt.framework/Headers
linux-g++:INCLUDEPATH += /usr/local/qwt-5.2.1/include
win32:INCLUDEPATH += C:/Qwt-5.2.1/include
FORMS += ui/
UI_HEADERS_DIR = inc_ui
OBJECTS_DIR = obj
MOC_DIR = moc
#mac:LIBS += /usr/local/qwt-6.1.0/lib -framework qwt
#mac:LIBS += -l /usr/local/qwt-6.1.0/lib/qwt.framework
mac:LIBS += -F /usr/local/qwt-6.1.0/lib -framework qwt
linux-g++:LIBS += /usr/local/qwt-5.2.1/lib/libqwt.so
win32:LIBS += C:/Qwt-5.2.1/lib/qwt5.dll
Any help is appreciated,
Thanks.

App crashes at start when using OpenCV 2.3.1 in Qt 4.8.0

I tried to control my camera using OpenCV functions. The building progress is fine, however, when I tried to run my program it crashes and Qt only gives the information about the exit code -1073741515. I tried to comment all of the code using OpenCV function and the program seems to be OK. Are the libraries I included the wrong ones?
opencv.pro
QT += core gui
TARGET = opencv
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
INCLUDEPATH += F:/opencv/build/include
INCLUDEPATH += F:/opencv/build/include/opencv
LIBS += F:/opencv/build/x86/mingw/lib/libopencv_calib3d231.dll.a
LIBS += F:/opencv/build/x86/mingw/lib/libopencv_contrib231.dll.a
LIBS += F:/opencv/build/x86/mingw/lib/libopencv_core231.dll.a
LIBS += F:/opencv/build/x86/mingw/lib/libopencv_features2d231.dll.a
LIBS += F:/opencv/build/x86/mingw/lib/libopencv_flann231.dll.a
LIBS += F:/opencv/build/x86/mingw/lib/libopencv_gpu231.dll.a
LIBS += F:/opencv/build/x86/mingw/lib/libopencv_highgui231.dll.a
LIBS += F:/opencv/build/x86/mingw/lib/libopencv_imgproc231.dll.a
LIBS += F:/opencv/build/x86/mingw/lib/libopencv_legacy231.dll.a
LIBS += F:/opencv/build/x86/mingw/lib/libopencv_ml231.dll.a
LIBS += F:/opencv/build/x86/mingw/lib/libopencv_objdetect231.dll.a
LIBS += F:/opencv/build/x86/mingw/lib/libopencv_video231.dll.a
mainwindow.cpp
Since MainWindow.cpp is long, I will just paste the constructor here and add the rest of them if needed.
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
cam = NULL;
frame = NULL;
timer = new QTimer;
imag = new QImage();
connect(timer,SIGNAL(timeout()),this,SLOT(readFrame()));
connect(ui->open,SIGNAL(clicked()),this,SLOT(openCamara()));
connect(ui->pic,SIGNAL(clicked()),this,SLOT(takingPictures()));
connect(ui->closeCam,SIGNAL(clicked()),this,SLOT(closeCamara()));
}
Finally GET IT WORK! When I try to run the app from Windows Explorer, it complains about lack of libstdc++-6.dll. Although there exist on under C:\QtSDK\mingw\bin, its version is incorrect for OpenCV 2.3 (or any other reason?) and will cause an error. I got one from here and the program runs correctly.

Linking Qt DLL to Qt App - unresolved references

I've just installed Qt 4.7.4 and trying to make a simple Qt App that uses Qt DLL. I added export/import in a class in DLL through ifdef as usual but when compiling App I het unresolved references. I also set that App depends on the DLL.
Here are the main files:
Lib.pro
QT -= gui
TARGET = Lib
TEMPLATE = lib
DEFINES += LIB_LIBRARY
SOURCES += lib.cpp
HEADERS += lib.h\
Lib_global.h
symbian {
MMP_RULES += EXPORTUNFROZEN
TARGET.UID3 = 0xE10C4E25
TARGET.CAPABILITY =
TARGET.EPOCALLOWDLLDATA = 1
addFiles.sources = Lib.dll
addFiles.path = !:/sys/bin
DEPLOYMENT += addFiles
}
unix:!symbian {
maemo5 {
target.path = /opt/usr/lib
} else {
target.path = /usr/lib
}
INSTALLS += target
}
App.pro
QT += core gui
TARGET = App
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
lib.h
#ifndef LIB_H
#define LIB_H
#include "Lib_global.h"
#include <QString>
class LIBSHARED_EXPORT Lib {
public:
Lib();
~Lib();
QString Hello(QString a);
};
#endif // LIB_H
Lib_global.h
#ifndef LIB_GLOBAL_H
#define LIB_GLOBAL_H
#include <QtCore/qglobal.h>
#if defined(LIB_LIBRARY)
# define LIBSHARED_EXPORT Q_DECL_EXPORT
#else
# define LIBSHARED_EXPORT Q_DECL_IMPORT
#endif
#endif // LIB_GLOBAL_H
What's wrong with this code? Why is it unresolved reference?
In App I just include "../Lib/lib.h" and try to use the class.
What looks to be missing is the link between your application and your dynamic library.
I usually do something like this for my desktop (linux) apps:
INCLUDEPATH += ./include
LIBS += -L./lib -lLib
Where:
INCLUDEPATH defines the path to where your shared library .h files are located.
LIBS defines the path to where your built library is.
You can find the relevant documentation here: QMake - Declaring Other Libraries
Updated:
I was able to build the project (Linux Qt v4.7.4) and link to the library using the code you posted. I will try to clarify as my response may not be entirely clear.
The INCLUDEPATH and LIBS variables must be added to the App.pro file.
For the linker to properly find the library the paths must be adjusted to the paths you are using for your project:
LIBS += -L PATH -l LIBNAME
Supposing your folder structure is similar to the following:
Project
|_ Lib (your sharded library project files)
|_ App (your application project files)
You would adjust the variables like so:
INCLUDEPATH += ../Lib
LIBS += -L../Lib -lLib
Note that you link differently depending on your platform, you can do something like this to cover Windows and Linux:
unix {
INCLUDEPATH += ../Lib
LIBS += -L../Lib -lLib
}
win32 {
INCLUDEPATH += ../Lib
LIBS += ../Lib.lib
}

Resources