Building gRPC with windows 10 and QT creator - C++ - c++

I'm trying to build gRPC library with Windows 10 with QT. Im using QT creator 5.15.2 MSVC 2019 compiler kit. I installed protobuf and grpc using vcpkg. I can able to successfully test protobuf libraries. But failing to do so with gRPC.
Getting the following error.
grpc.lib(check_gcp_environment_windows.cc.obj):-1: error: LNK2019: unresolved external symbol imp_RegGetValueA referenced in function "bool cdecl grpc_core::internal::check_windows_registry_product_name(struct HKEY *,char const *,char const *)" (?check_windows_registry_product_name#internal#grpc_core##YA_NPEAUHKEY##PEBD1#Z)
I have tried linking the libraries one by one in QT like below. Attached my .pro file here
QT -= gui
CONFIG += c++17 console
CONFIG -= app_bundle
# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/zlibd.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/abseil_dll.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/absl_cord_internal.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/absl_cordz_functions.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/absl_cordz_handle.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/absl_cordz_info.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/absl_cordz_sample_token.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/absl_flags.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/absl_flags_commandlineflag.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/absl_flags_commandlineflag_internal.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/absl_flags_config.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/absl_flags_internal.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/absl_flags_marshalling.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/absl_flags_parse.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/absl_flags_private_handle_accessor.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/absl_flags_program_name.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/absl_flags_reflection.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/absl_flags_usage.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/absl_flags_usage_internal.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/absl_low_level_hash.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/absl_random_internal_distribution_test_util.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/absl_statusor.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/absl_strerror.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/address_sorting.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/cares.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/descriptor_upb_proto.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/gpr.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/grpc.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/grpc_plugin_support.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/grpc_unsecure.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/grpc++.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/grpc++_alts.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/grpc++_error_details.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/grpc++_reflection.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/grpc++_unsecure.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/grpcpp_channelz.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/libcrypto.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/libprotobufd.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/libprotobuf-lited.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/libprotocd.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/libssl.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/re2.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/upb.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/upb_collections.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/upb_extension_registry.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/upb_fastdecode.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/upb_json.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/upb_mini_table.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/upb_reflection.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/upb_textformat.lib
LIBS += C:/vcpkg/installed/x64-windows/debug/lib/upb_utf8_range.lib
INCLUDEPATH += C:\vcpkg\installed\x64-windows\include
HEADERS += \
helloworld.grpc.pb.h \
helloworld.pb.h
SOURCES += \
main.cpp \
helloworld.grpc.pb.cc \
helloworld.pb.cc
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
There were few errors w.r.2 ws2_32 lib. which I have neglected using the following pragma statement.
#pragma comment(lib, "Ws2_32.lib")
But the error LNK2019: unresolved external symbol __imp_RegGetValueA referenced in function . I couldnt find any. I believe its something related to re2.lib linked. Kindly add your thoughts. Thanks

Related

How to resolve link error in Qt using Telegram library (Td)

I have encountered with link error while building example app, this one (https://github.com/tdlib/td/blob/master/example/cpp/td_example.cpp) I created project in Qt creator and added td_example.cpp to project. Also previously I have build 32x Td library from sources using this instruction https://tdlib.github.io/td/build.html?language=C%2B%2B .
Td artifacts located in this path K:\QtProjects\Telegram\TelegramDependency\td\tdlib ,
here is located 3 folders (bin, include and lib).
in bin folder located 4 .dll files (libcrypto-1_1.dll, libssl-1_1.dll, tdjson.dll, zlibd1.dll)
in lib folder located (tdactor.lib, tdapi.lib, tdclient.lib, tdcore.lib, tddb.lib, tdjson.lib, tdjson_private.lib, tdjson_static.lib, tdnet.lib, tdsqlite.lib, tdutils.lib)
My project located under this path K:\QtProjects\Telegram\TelegramTestAPP
in folder TelegramTestAPP i have .pro file with such content.
QT += quick
CONFIG += c++20
# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
Logger.cpp \
main.cpp \
RESOURCES += qml.qrc
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
# Additional import path used to resolve QML modules just for Qt Quick Designer
QML_DESIGNER_IMPORT_PATH =
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
HEADERS += \
Logger.h \
td_example.h
win32: LIBS += -L'$$PWD/../TelegramDependency/td/tdlib/lib/' -ltdjson
INCLUDEPATH += $$PWD/../TelegramDependency/td/tdlib/include
DEPENDPATH += $$PWD/../TelegramDependency/td/tdlib/include
i removed main function from td_example.cpp and renamed to td_example.h , after that I included this header file and called it from main.cpp inside main function
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include "td_example.h"
int main(int argc, char *argv[])
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
engine.rootContext()->setContextProperty(QStringLiteral("CLogger"), &Logger::GetInstance());
const QUrl url(QStringLiteral("qrc:/main.qml"));
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
&app, [url](QObject *obj, const QUrl &objUrl) {
if (!obj && url == objUrl)
QCoreApplication::exit(-1);
}, Qt::QueuedConnection);
engine.load(url);
TdExample example;
example.loop();
return app.exec();
}
So the question is, why i get link error
example of error
main.obj:-1: error: LNK2019: unresolved external symbol "public: __thiscall td::td_api::tdlibParameters::tdlibParameters(void)" (??0tdlibParameters#td_api#td##QAE#XZ) referenced in function "class td::tl::unique_ptr<class td::td_api::tdlibParameters> __cdecl td::td_api::make_object<class td::td_api::tdlibParameters>(void)" (??$make_object#VtdlibParameters#td_api#td##$$V#td_api#td##YA?AV?$unique_ptr#VtdlibParameters#td_api#td###tl#1#XZ)
compiler: Microsoft Visual C++ Complier 14.0 (amd64_x86)
I also copied all .dll from bin folder to debug folder (TelegramTestAPP/build/debug)
EDIT
Added all static libraries to .pro file
win32: LIBS += -L'$$PWD/../TelegramDependency/td/tdlib/lib/' -ltdapi
win32: LIBS += -L'$$PWD/../TelegramDependency/td/tdlib/lib/' -ltdutils
win32: LIBS += -L'$$PWD/../TelegramDependency/td/tdlib/lib/' -ltdclient
win32: LIBS += -L'$$PWD/../TelegramDependency/td/tdlib/lib/' -ltdnet
win32: LIBS += -L'$$PWD/../TelegramDependency/td/tdlib/lib/' -ltdcore
win32: LIBS += -L'$$PWD/../TelegramDependency/td/tdlib/lib/' -ltdsqlite
win32: LIBS += -L'$$PWD/../TelegramDependency/td/tdlib/lib/' -ltdactor
win32: LIBS += -L'$$PWD/../TelegramDependency/td/tdlib/lib/' -ltddb
INCLUDEPATH += $$PWD/../TelegramDependency/td/tdlib/include
DEPENDPATH += $$PWD/../TelegramDependency/td/tdlib/include
win32: PRE_TARGETDEPS += $$PWD/../TelegramDependency/td/tdlib/lib/tdcore.lib
win32: PRE_TARGETDEPS += $$PWD/../TelegramDependency/td/tdlib/lib/tdapi.lib
win32: PRE_TARGETDEPS += $$PWD/../TelegramDependency/td/tdlib/lib/tdclient.lib
win32: PRE_TARGETDEPS += $$PWD/../TelegramDependency/td/tdlib/lib/tdutils.lib
win32: PRE_TARGETDEPS += $$PWD/../TelegramDependency/td/tdlib/lib/tdactor.lib
win32: PRE_TARGETDEPS += $$PWD/../TelegramDependency/td/tdlib/lib/tddb.lib
win32: PRE_TARGETDEPS += $$PWD/../TelegramDependency/td/tdlib/lib/tdnet.lib
win32: PRE_TARGETDEPS += $$PWD/../TelegramDependency/td/tdlib/lib/tdsqlite.lib
win32: LIBS += -L'C:/Program Files (x86)/OpenSSL-Win32/lib/VC/' -llibcrypto32MDd
win32: LIBS += -L'C:/Program Files (x86)/OpenSSL-Win32/lib/VC/' -llibssl32MDd
INCLUDEPATH += 'C:/Program Files (x86)/OpenSSL-Win32/include'
DEPENDPATH += 'C:/Program Files (x86)/OpenSSL-Win32/include'
new Errors (compiler gcc 32 bit)
error: undefined reference to `td::ClientManager::execute(td::tl::unique_ptr<td::td_api::Function>&&)'
debug/TdController.o: In function `ZN12TdControllerC2Ev':
error: undefined reference to `td::td_api::setLogVerbosityLevel::setLogVerbosityLevel(int)'
debug/TdController.o: In function `ZN2td6td_api11make_objectINS0_20setLogVerbosityLevelEJiEEENS_2tl10unique_ptrIT_EEDpOT0_':
error: undefined reference to `vtable for td::td_api::setLogVerbosityLevel'
debug/TdController.o: In function `ZN2td6td_api20setLogVerbosityLevel
D1Ev':
I don't know those libs, but according to this https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1tdlib_parameters-members.html the symbol you are missing is from td_api, which is not linked it seems. Did you try to link to other libs, in particular tdapi.lib?

Can't use OSG with GDAL on Windows

I work on Windows 10 x64
IDE: QtCreator 4.8.0 Based on Qt 5.12.0 (MSVC 2015, 32 bit)
Content of my .pro file is at the very bottom if it's needed.
There is a minimal OSG sample (main.cpp):
#include <osgDB/ReadFile>
#include <osgViewer/Viewer>
#include <ogrsf_frmts.h>
int main(int argc, char *argv[]) {
// OGRPoint p; //breakpoint 1
osg::ref_ptr<osg::Node> root = osgDB::readNodeFile("../resourses/cessna.osg"); //breakpoint 2
osgViewer::Viewer viewer;
viewer.setSceneData(root.get());
return viewer.run();
}
In the code above you can see, where i set breakpoints.
So:
In case with commented OGRPoint p;:
It compiles, runs, stops on "breakpoint 2" and when i go forward it shows the airplane (model "cessna.osg"). This is correct behavior.
In case with uncommented OGRPoint p;:
It compiles, runs and ignore both breakpoints. It doesn't show anything. As if i had nothing in my main. If i do it on Linux, then it works fine. Why does it can happen?
.pro file, if it affects :
TEMPLATE = app
TARGET = hello
QT -= gui
CONFIG += c++11 console
CONFIG -= app_bundle
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
#<--------------------- OSG Library
win32 {
OSG_LIB_DIRECTORY = $$(OSG_BIN)
OSG_INCLUDE_DIRECTORY = $$(OSG_INCLUDE)
CONFIG(debug, debug|release) {
TARGET = $$join(TARGET,,,_d)
LIBS += -L$$OSG_LIB_DIRECTORY -losgd
LIBS += -L$$OSG_LIB_DIRECTORY -losgViewerd
LIBS += -L$$OSG_LIB_DIRECTORY -losgDBd
LIBS += -L$$OSG_LIB_DIRECTORY -lOpenThreadsd
LIBS += -L$$OSG_LIB_DIRECTORY -losgUtild
LIBS += -L$$OSG_LIB_DIRECTORY -losgGAd
} else {
LIBS += -L$$OSG_LIB_DIRECTORY -losg
LIBS += -L$$OSG_LIB_DIRECTORY -losgViewer
LIBS += -L$$OSG_LIB_DIRECTORY -losgDB
LIBS += -L$$OSG_LIB_DIRECTORY -lOpenThreads
LIBS += -L$$OSG_LIB_DIRECTORY -losgUtil
LIBS += -L$$OSG_LIB_DIRECTORY -losgGA
}
INCLUDEPATH += $$OSG_INCLUDE_DIRECTORY
}
unix {
CONFIG(debug, debug|release) {
TARGET = $$join(TARGET,,,_d)
LIBS += -losgd
LIBS += -losgViewerd
LIBS += -losgDBd
LIBS += -lOpenThreadsd
} else {
LIBS += -losg
LIBS += -losgViewer
LIBS += -losgDB
LIBS += -lOpenThreads
}
}
#--------------------- OSG Library !>
HEADERS += $$OSG_INCLUDE_DIRECTORY
#<--------------------- GDAL Library
win32 {
INCLUDEPATH += D:/Interface/Work/Libs/gdal/include/
LIBS += D:/Interface/Work/Libs/gdal/lib/libgdal-20.dll
}
unix {
LIBS += -L/usr/local/lib -lgdal
}
#--------------------- GDAL Library !>
Problem was that the library needed libgdal-20.dll to work. I didn't specify the path to the .dll. So i resolved this problem by copiyng the .dll file into folder with binaries. Now it works fine.

ITK with QT: undefined reference vnl_vector in metadataobject.cxx

I am trying to compile a Qt project that uses ITK but I am receiving linker errors (see below) from the ITK libraries. I am running on Ubuntu 16.04 and building with Qt 5.9.1. I compiled the ITK version 4.12.1 but I have also tried 4.13 as well as a pre-built version of 4.12.2 from a colleague. I have tried compiling with CMake 3.5 and later with CMake 3.10 but I get the same errors for all of these combinations.
I have generated the list of libraries that I include in my Qt project using the command lorder * | tsort while in the lib folder of the ITK build. This should generate the correct order of include libraries right?
The compiler is complaining about not finding vnl_vector, but I checked the list of linked libraries and -litkvnl as well as -litkvnl_algo are in there and above -lITKCommon which seems to be the problem.
Below I have provided the compile errors as well as the .pri file in which I link to the libraries. Any help would be greatly appreciated!
Error message:
//usr/local/lib/libITKCommon-4.12.a(itkMetaDataObject.cxx.o): In function `itk::MetaDataObject<itk::Array<char> >::~MetaDataObject()':
itkMetaDataObject.cxx:(.text._ZN3itk14MetaDataObjectINS_5ArrayIcEEED2Ev[_ZN3itk14MetaDataObjectINS_5ArrayIcEEED5Ev]+0x2a): undefined reference to `vnl_vector<char>::~vnl_vector()'
//usr/local/lib/libITKCommon-4.12.a(itkMetaDataObject.cxx.o): In function `itk::MetaDataObject<itk::Array<int> >::~MetaDataObject()':
itkMetaDataObject.cxx:(.text._ZN3itk14MetaDataObjectINS_5ArrayIiEEED2Ev[_ZN3itk14MetaDataObjectINS_5ArrayIiEEED5Ev]+0x2a): undefined reference to `vnl_vector<int>::~vnl_vector()'
Makefile:249: recipe for target 'mesh2binary' failed
//usr/local/lib/libITKCommon-4.12.a(itkMetaDataObject.cxx.o): In function `itk::MetaDataObject<itk::Array<float> >::~MetaDataObject()':
itkMetaDataObject.cxx:(.text._ZN3itk14MetaDataObjectINS_5ArrayIfEEED2Ev[_ZN3itk14MetaDataObjectINS_5ArrayIfEEED5Ev]+0x2a): undefined reference to `vnl_vector<float>::~vnl_vector()'
//usr/local/lib/libITKCommon-4.12.a(itkMetaDataObject.cxx.o): In function `itk::MetaDataObject<itk::Array<char> >::SetMetaDataObjectValue(itk::Array<char> const&)':
itkMetaDataObject.cxx:(.text._ZN3itk14MetaDataObjectINS_5ArrayIcEEE22SetMetaDataObjectValueERKS2_[_ZN3itk14MetaDataObjectINS_5ArrayIcEEE22SetMetaDataObjectValueERKS2_]+0x26): undefined reference to `vnl_vector<char>::set_size(unsigned long)'
itkMetaDataObject.cxx:(.text._ZN3itk14MetaDataObjectINS_5ArrayIcEEE22SetMetaDataObjectValueERKS2_[_ZN3itk14MetaDataObjectINS_5ArrayIcEEE22SetMetaDataObjectValueERKS2_]+0x39): undefined reference to `vnl_vector<char>::operator=(vnl_vector<char> const&)'
//usr/local/lib/libITKCommon-4.12.a(itkMetaDataObject.cxx.o): In function `itk::MetaDataObject<itk::Array<int> >::SetMetaDataObjectValue(itk::Array<int> const&)':
itkMetaDataObject.cxx:(.text._ZN3itk14MetaDataObjectINS_5ArrayIiEEE22SetMetaDataObjectValueERKS2_[_ZN3itk14MetaDataObjectINS_5ArrayIiEEE22SetMetaDataObjectValueERKS2_]+0x26): undefined reference to `vnl_vector<int>::set_size(unsigned long)'
itkMetaDataObject.cxx:(.text._ZN3itk14MetaDataObjectINS_5ArrayIiEEE22SetMetaDataObjectValueERKS2_[_ZN3itk14MetaDataObjectINS_5ArrayIiEEE22SetMetaDataObjectValueERKS2_]+0x39): undefined reference to `vnl_vector<int>::operator=(vnl_vector<int> const&)'
//usr/local/lib/libITKCommon-4.12.a(itkMetaDataObject.cxx.o): In function `itk::MetaDataObject<itk::Array<float> >::SetMetaDataObjectValue(itk::Array<float> const&)':
itkMetaDataObject.cxx:(.text._ZN3itk14MetaDataObjectINS_5ArrayIfEEE22SetMetaDataObjectValueERKS2_[_ZN3itk14MetaDataObjectINS_5ArrayIfEEE22SetMetaDataObjectValueERKS2_]+0x26): undefined reference to `vnl_vector<float>::set_size(unsigned long)'
itkMetaDataObject.cxx:(.text._ZN3itk14MetaDataObjectINS_5ArrayIfEEE22SetMetaDataObjectValueERKS2_[_ZN3itk14MetaDataObjectINS_5ArrayIfEEE22SetMetaDataObjectValueERKS2_]+0x39): undefined reference to `vnl_vector<float>::operator=(vnl_vector<float> const&)'
collect2: error: ld returned 1 exit status
make: *** [mesh2binary] Error 1
11:24:11: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project mesh2binary (kit: Desktop Qt 5.9.1 GCC 64bit2)
When executing step "Make"
.pri file which I include in my .pro file:
ITKDIR=/usr/local/ITK/InsightToolkit-4.12.1-Release/include/ITK-4.12
ITKLIB=/usr/local/ITK/InsightToolkit-4.12.1-Release/build/lib
VERSIONNUMBER=4.12
#Include ITK Headers
INCLUDEPATH += $${ITKDIR}
# ITK Libs
LIBS += -L$${ITKLIB} -lITKBiasCorrection-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKBioCell-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKDICOMParser-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKFEM-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKIOBMP-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKIOBioRad-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKIOCSV-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKIOGDCM-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKIOGE-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKIOGIPL-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKIOHDF5-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKIOJPEG-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKIOLSM-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKIOMRC-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKIOMesh-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKIOMeta-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKIONIFTI-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKIONRRD-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKIOPNG-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKIOSiemens-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKIOSpatialObjects-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKIOStimulate-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKIOTransformBase-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKIOTransformHDF5-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKIOTransformInsightLegacy-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKIOTransformMatlab-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKIOVTK-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKKLMRegionGrowing-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKLabelMap-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKMesh-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKOptimizers-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKOptimizersv4-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKPath-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKPolynomials-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKQuadEdgeMesh-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKSpatialObjects-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKStatistics-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKTransform-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKVNLInstantiation-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKVTK-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKVideoCore-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKVideoIO-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKWatersheds-$${VERSIONNUMBER}
#LIBS += -L$${ITKLIB} -lhdf5
LIBS += -L$${ITKLIB} -litkgdcmMEXD-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -litknetlib-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -litktestlib-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKIOTIFF-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKgiftiio-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKMetaIO-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKNrrdIO-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -litkpng-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKIOIPL-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKIOXML-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKTransformFactory-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -litkhdf5_cpp
LIBS += -L$${ITKLIB} -litkNetlibSlatec-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -litkvnl_algo-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -litkgdcmMSFF-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -litkgdcmsocketxx-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -litktiff-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKniftiio-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKIOImageBase-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -litkhdf5
LIBS += -L$${ITKLIB} -litkvnl-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -litkv3p_netlib-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -litkgdcmDICT-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -litkgdcmcharls-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -litkgdcmuuid-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -litkgdcmopenjpeg-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -litkgdcmjpeg8-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -litkgdcmjpeg16-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -litkgdcmjpeg12-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -litkjpeg-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKznz-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKCommon-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -litkvcl-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -litkgdcmIOD-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -litksys-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -litkdouble-conversion-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -litkgdcmDSED-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -lITKEXPAT-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -litkgdcmCommon-$${VERSIONNUMBER}
LIBS += -L$${ITKLIB} -litkzlib-$${VERSIONNUMBER}
I would suggest you to convert your project's build system into CMake. I do not advice build ITK with any other system than CMake. Since 2.8.10 it is quite stable, and if you even have a current version, there should be no problems.
Your CMakeLists.txt file would probably look similiar to this:
cmake_minimum_required(VERSION 3.1)
set (CMAKE_CXX_STANDARD 11)
project(HelloWorldItkQt)
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc and uic automatically when needed.
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
# Find the Qt libraries
find_package(Qt5Gui)
find_package(Qt5Widgets)
find_package(Qt5Core)
#find and enable ITK
find_package(ITK)
include(${ITK_USE_FILE})
# Tell CMake to create the helloworld executable
add_executable(HelloWorldItkQt WIN32 mainwindow.h simpledialog.h mainwindow.cpp simpledialog.cpp main.cpp)
# Use the Widgets module from Qt 5.
target_link_libraries(HelloWorldItkQt Qt5::Widgets Qt5::Gui Qt5::Core ${ITK_LIBRARIES})
Here you will find some more information:
Qt5 and Cmake manual
Similar SO problem

OpenCV 2.4.10 + Qt Creator 3.2.0 & Qt5.4.0 MingW 64bits Windows 7 - "exited with code -1073741515"

I have compiled OpenCV 2.4.10 to work with Qt 5.4 mingw for 64 bits. When I compile the most basic example of loading a picture it gives the following error:
exited with code -1073741515
Does anyone knows what this means and how I could fix it?
QT += core
QT += gui
TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt
TEMPLATE = app
SOURCES += main.cpp
INCLUDEPATH += C://opencv2_build//install//include
LIBS += C://opencv2_build//bin//*.dll
The error code means "Dependency missing". A working configuration for OpenCV in QT should looks like this:
LIBS += -LC:\\Programs\\opencv24\\opencv_bin2\\bin \
libopencv_core240d \
libopencv_highgui240d \
libopencv_imgproc240d \
libopencv_features2d240d \
libopencv_calib3d240d \
Source: here
Looks like an error where you're not linking with OpenCV correctly. This is an example of how you can link your application correctly (put it in your .pro file):
win32 {
OPENCV_LIB_DIR = $$PWD/libs/opencv/Windows
INCLUDEPATH += $$PWD/include/opencv/Windows
}
linux {
OPENCV_LIB_DIR = $$PWD/libs/opencv/Linux
INCLUDEPATH += $$PWD/include/opencv/Linux
LIBS += -L$$OPENCV_LIB_DIR
}
message(OpenCV Library directory: $$OPENCV_LIB_DIR)
LIBS += -L$$OPENCV_LIB_DIR
win32 {
LIBS += -lopencv_core248
LIBS += -lopencv_calib3d248
LIBS += -lopencv_contrib248
LIBS += -lopencv_features2d248
LIBS += -lopencv_flann248
LIBS += -lopencv_gpu248
LIBS += -lopencv_highgui248
LIBS += -lopencv_imgproc248
LIBS += -lopencv_legacy248
LIBS += -lopencv_ml248
LIBS += -lopencv_nonfree248
LIBS += -lopencv_objdetect248
LIBS += -lopencv_ocl248
LIBS += -lopencv_photo248
LIBS += -lopencv_stitching248
LIBS += -lopencv_superres248
LIBS += -lopencv_video248
LIBS += -lopencv_videostab248
}
linux {
LIBS += -lopencv_core
LIBS += -lopencv_calib3d
LIBS += -lopencv_contrib
LIBS += -lopencv_cuda
LIBS += -lopencv_cudaarithm
LIBS += -lopencv_cudabgsegm
LIBS += -lopencv_cudacodec
LIBS += -lopencv_cudafeatures2d
LIBS += -lopencv_cudafilters
LIBS += -lopencv_cudaimgproc
LIBS += -lopencv_cudaoptflow
LIBS += -lopencv_cudastereo
LIBS += -lopencv_cudawarping
LIBS += -lopencv_features2d
LIBS += -lopencv_flann
LIBS += -lopencv_highgui
LIBS += -lopencv_imgproc
LIBS += -lopencv_legacy
LIBS += -lopencv_ml
LIBS += -lopencv_nonfree
LIBS += -lopencv_objdetect
LIBS += -lopencv_optim
LIBS += -lopencv_photo
LIBS += -lopencv_shape
LIBS += -lopencv_softcascade
LIBS += -lopencv_stitching
LIBS += -lopencv_superres
LIBS += -lopencv_ts
LIBS += -lopencv_video
LIBS += -lopencv_videostab
}
Notice that I use the -L flag to tell what the library folder is, and then the -l flag against each DLL (Windows) or .so (Linux). You have a few different options in regards to how you actually want to link the library, but this method works for me. Hope this helps!

How to add external libraries to qt4 application c++

what is the best way to add additional compiled libraries to my qt project ?
For example boost or poco libs ?
Thanks :)
If you're using the GCC compiler add something like this to the .pro file:
For Boost:
INCLUDEPATH += d:/Biblioteki/C++/boost/boost_1_44_0a
LIBPATH += d:/Biblioteki/C++/boost/boost_1_44_0a/stage/lib
LIBS += -lboost_system-mgw44-mt-d-1_44
LIBS += -lboost_filesystem-mgw44-mt-d-1_44
LIBS += -lboost_date_time-mgw44-mt-d-1_44
For Poco:
INCLUDEPATH += d:/Biblioteki/C++/Poco/poco-1.3.6p2-mingw-qt2/include
LIBPATH += d:/Biblioteki/C++/Poco/poco-1.3.6p2-mingw-qt2/lib
LIBS += -lPocoFoundationd
LIBS += -lPocoNetd
LIBS += -lPocoUtild
LIBS += -lPocoXML
INCLUDEPATH - is the location of directory with header files
LIBPATH - is the location of directory with *.a files
LIBS - contains list of libraries you want to use in your application