Library Version Mismatch (C++ HDF5 Windows) - c++

When trying to run a simple program using the hdf5-file format i get these messages and the program crashes:
I found posts to other problems like this, but most of them refer to linux and python. I use C++ (Qt Creator) and Windows (Windows 7 64bit) with the MSVC17 64bit Compiler, so these solutions dont work for me.
I don't understand why this occurs, because i simply donwloaded the HDF5 version 1.10.2 and installed it, i don't know why it says something about the version 1.8.15. Where could this come from?
I guess "library version" (1.8.15) is the version of my hdf5.lib file, right?
What does "header version" (1.10.2) mean? I simply #include <hdf5.h> and #include <H5Cpp.h> in the main.cpp and added paths in the hdf5_test_2.pro (my project) file.
Here is my code:
hdf5_test.pro:
TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += \
main.cpp
win32: LIBS += -L'C:/Program Files/HDF_Group/HDF5/1.10.2/lib/' -lhdf5 -lhdf5_cpp -lhdf5_hl_cpp
INCLUDEPATH += 'C:/Program Files/HDF_Group/HDF5/1.10.2/include'
DEPENDPATH += 'C:/Program Files/HDF_Group/HDF5/1.10.2/include'
win32:!win32-g++: PRE_TARGETDEPS += 'C:/Program Files/HDF_Group/HDF5/1.10.2/lib/libhdf5.lib'
else:win32-g++: PRE_TARGETDEPS += 'C:/Program Files/HDF_Group/HDF5/1.10.2/lib/liblibhdf5.a'
main.cpp:
#include <iostream>
#include <hdf5.h>
#include <H5Cpp.h>
using namespace std;
using namespace H5;
int main()
{
hid_t file_id;
herr_t status;
file_id = H5Fcreate("file.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
status = H5Fclose(file_id);
cout << "Hello World!" << endl;
return 0;
}
The code example i tried to use comes from High Level Introduction to HDF5 (Pages 16/17).
Solved (meaning next error)
I think i solved the problem: There was another Version of HDF5 installed (1.8.15) on the system (the one who used this PC before me installed it).
I told my programm to link my lib (1.10.2) and passed the path, but somehow he found the 1.8.15 version previously installed. I now told my program to link the old version and it worked.
My hdf5_test_2.pro (my project) looks now like this:
TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += \
main.cpp
win32: LIBS += -LC:/Anaconda2/Library/lib/ -lhdf5 -lhdf5_cpp
INCLUDEPATH += C:/Anaconda2/Library/include
DEPENDPATH += C:/Anaconda2/Library/include
Nice so far, but i get these two warnings now:
Any ideas, what that means?

Related

Using Caffe in Qt Console Application

I am trying to use caffe in Qt IDE,
I have the following code:
#include <QCoreApplication>
#include "caffe/caffe.hpp"
using namespace caffe;
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
Caffe::set_mode(Caffe::CPU);
return a.exec();
}
I just wanted to set Caffe in CPU Mode.
I have the following .pro file
QT += core
QT -= gui
CONFIG += c++11
TARGET = CaffeTest_v0
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
INCLUDEPATH += /home/ahmet/caffe/include \
/home/ahmet/caffe/distribute/include \
/home/ahmet/caffe/build/lib
LIBS += -lcaffe
SOURCES += main.cpp
I have the following problem :
My problem is I want to set caffe in CPU mode, I installed caffe in CPU mode.
How can I set Caffe in CPU mode in main?
P.S. I believe I installed caffe corectly, because I tested by the following command in gnome terminal
caffe train -solver lenet_train_solver.prototxt
I also searched the following websites:
http://tzutalin.blogspot.co.uk/2015/05/caffe-on-ubuntu-eclipse-cc.html
Error while including Caffe in C++ Project using cmake
https://github.com/BVLC/caffe/issues/3317
https://groups.google.com/forum/#!topic/caffe-users/DAv5EcsvbIU
In .pro file, I should add
DEFINES += CPU_ONLY
solves the problem.
Final .pro file is below:
QT += core
QT -= gui
CONFIG += c++11
TARGET = CaffeTest_v0
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
DEFINES += CPU_ONLY
INCLUDEPATH += /home/ahmet/caffe/include \
/home/ahmet/src/caffe/proto \
/usr/include/boost
LIBS += -L/home/ahmet/caffe/build/lib \
-lcaffe \
-L/usr/lib/x86_64-linux-gnu \
-lboost_system
SOURCES += main.cpp

Undefined reference aiImportfile (assimp) using QT

I have bee trying to get assimp running in QT 5.2 in order to import some 3D objects, but Im having a problem with (I believe) the linker.
I installed it via cmake, first downloading the source files from here http://sourceforge.net/projects/assimp/files/assimp-3.0/, then using cmake to compile and install.
Then, I have tried to run the example they provide in the documentation
#include <assimp/cimport.h> // Plain-C interface
#include <assimp/scene.h> // Output data structure
#include <assimp/postprocess.h> // Post processing flags
bool DoTheImportThing( const char* pFile)
{
// Start the import on the given file with some example postprocessing
// Usually - if speed is not the most important aspect for you - you'll t
// probably to request more postprocessing than we do in this example.
const aiScene* scene = aiImportFile( pFile,
aiProcess_CalcTangentSpace |
aiProcess_Triangulate |
aiProcess_JoinIdenticalVertices |
aiProcess_SortByPType);
// If the import failed, report it
if( !scene)
{
// DoTheErrorLogging( aiGetErrorString());
return false;
}
return true;
}
But when trying to compile this piece of code, I get the error
error: undefined reference to `aiImportFile'
error: collect2: error: ld returned 1 exit status
I am using a 32 bit linux mint. Does anybody have any idea why is it not linking? Should I have compiled with cmake using a specific flag? i havent been able to found any special flags in any posts around.
Thanks!
I finally solved it! Apparently, QT has a tool for importing external libraries. I just had to right click on the project, click add library, and add the file located at /user/local/libassimp.a
This added the following lines to my .pro file:
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../usr/local/lib/release/ -lassimp
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../usr/local/lib/debug/ -lassimp
else:unix: LIBS += -L$$PWD/../../../../../usr/local/lib/ -lassimp
INCLUDEPATH += $$PWD/../../../../../usr/local/include
DEPENDPATH += $$PWD/../../../../../usr/local/include
win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../../../../../usr/local/lib/release/libassimp.a
else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../../../../usr/local/lib/debug/libassimp.a
else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../../../../../usr/local/lib/release/assimp.lib
else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../../../../usr/local/lib/debug/assimp.lib
else:unix: PRE_TARGETDEPS += $$PWD/../../../../../usr/local/lib/libassimp.a
Theres possibly a more elegant way of coding that, but at least it worked.

Configure Qt Creator to use TBB on Windows [duplicate]

I have compiled TBB from source using Mingw following the comment #5 in this post: http://software.intel.com/en-us/forums/topic/291331. That went ok.
When I try to use the new TBB library in a QtCreator project, I end with this errors (ignore the warning messages): http://postimage.org/image/yrrecugix/
Here's the sample code I tried (I omit the non-tbb code):
#include "tbb/task_scheduler_init.h"
int main()
{
tbb::task_scheduler_init init;
/// more things.
}
And here's the .pro file:
TEMPLATE = app
CONFIG += console
CONFIG -= qt
SOURCES += main.cpp
#QMAKE_CXXFLAGS += -fopenmp
#QMAKE_LFLAGS += -fopenmp
INCLUDEPATH += "E:\TRABAJO\LIBRERIAS\tbb-4.1_src\include"
LIBS += -L"E:\TRABAJO\LIBRERIAS\tbb-4.1_src\build\windows_intel64_gcc_mingw4.5.4_debug\" \
-ltbb_debug
Any idea?.
Thanks!.
When built with MinGW on Windows, TBB binaries are tbb.dll and tbb_debug.dll. The option -ltbb_debug in your configuration files probably causes the linker to look for libtbb_debug.<something>. It can't find such a binary and reports about unresolved symbols.

No rule to make target

I am trying to make QT application using C++ language which will record the video from analogue camera. so I included the videoInput.h and videoInput.lib files in my project but when i am trying to run the my project then the following error occurs.
the error is:
mingw32-make[1]: No rule to make target path/to/videoInputd.lib', needed by 'debug\test.exe'. Stop.
please give me the solution.
thanks for help.
Thanks for your reply. I already added LIBS.
My .pro file is
QT += core gui
QT += widgets
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = test
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h \
../../../"Qt Projects/Test projects/test" \
videoInput.h
FORMS += mainwindow.ui
INCLUDEPATH += E:\\ImageProcessing\\opencv_cmake_binaries\\install\\include
LIBS += -LE:\\ImageProcessing\\opencv_cmake_binaries\\install\\lib \
-lopencv_core244.dll \
-lopencv_highgui244.dll \
-lopencv_imgproc244.dll \
-lopencv_features2d244.dll \
-lopencv_calib3d244.dll
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/ -lvideoInput
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/ -lvideoInputd
INCLUDEPATH += $$PWD/../../../"Qt Projects/Test projects/test/videoInput"
DEPENDPATH += $$PWD/../../../"Qt Projects/Test projects/test/videoInput"
win32:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/videoInput.lib
else:win32:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/videoInputd.lib
end of .pro file.
and I changed the build mode to release mode and then try to run then new error comes. The error is
error: redefinition of 'bool comInit'
error: 'bool comInit' previously declared here
static bool comInit;
error: redefinition of 'class videoInput'
class videoInput{
error: previous definition of 'class videoInput'
class videoInput{
These four errors are in videoinput.h file the compiler shows me like this.
And I know the file name is videoInput.h but compile output shows me that videoInputd.lib, needed by debug\test.exe
Do as Sebastian tells (add videoInput.lib to LIBS) and switch build mode to release, since you have only release version of this library (videoInput.lib, not videoInputd.lib).
I got the solution. When I was trying to include videoInput.lib file in Qt creator, at that time it was displayed above mention error.
So I used qt-vs-addin which is available here. qt-vs-addin.
I designed GUI in qt-vs-addin using visual studio 2010 for my application and include videoInput.lib file in visual studio 2010 and now my application is ready. This will be helpful for someone.
Thanks to all.
I had similare problem "No tule ro mske tsrgrt. Th rrason was syntax error like
testwx:($(OBJS).... Check your syntax line by line

Qt C++ ffmpeg cannot find library

I use Qt 5.0.2 with Mingw 4.7 on windows.
I'm working on a c++ program and i'm trying to get the duration of video files. I found ffmpeg. Now i tried to compile a simple program but I think it fails with the libraries. I've tried to include both the shared and dev but they both will fail. ( Zeranoe FFmpeg builds)
This is my pro file:
TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += main.cpp
INCLUDEPATH += C:\programming\ffmpeg-20130606-git--win32-shared\bin
LIBS += -LC:\programming\ffmpeg-20130606-git--win32-shared\bin -lavcodec-55.dll - lavformat-55.dll -lavutil-52.dll
i get errors like:
":-1: error: cannot find -lavcodec-55.dll"
":-1: error: cannot find -lavformat-55.dll"
I've also tried:
INCLUDEPATH += C:\programming\ffmpeg-20130606-git--win32-dev\include
INCLUDEPATH += C:\programming\ffmpeg-20130606-git--win32-dev\lib
LIBS += -LC:\programming\ffmpeg-20130606-git--win32-dev\lib -lavcodec -lavformat -lavutil
LIBS += -LC:\programming\ffmpeg-20130606-git--win32-dev\lib -llibavcodec.dll.a -llibavformat.dll.a -llibavutil.dll.a
Here it gives a error "During startup program exited with code 0x0000135'
I even tried to include each library individually. But no results..
This is my main file:
#include <iostream>
using namespace std;
extern "C" {
#include <libavcodec/avcodec.h> // required headers
#include <libavformat/avformat.h>
}
int main(int argc, char**argv) {
av_register_all(); // offending library call
return 0;
}
A program simple as this will have 2 outcomes:
the program runs but crashes if i call 'av_register_all()'
It just tells me he cannot find the libraries.
Can someone tell me what it is i'm doing wrong? Or even give me a hint? I can't really find a lot of good documentation on this one.
Thanks in advance!
Configure PRO-file as shown below:
INCLUDEPATH += C:\programming\ffmpeg-20130606-git--win32-dev\include
LIBS += -LC:\programming\ffmpeg-20130606-git--win32-dev\lib
LIBS += -lavcodec -lavformat -lavutil
Then, build the project, copy the all dll libraries from C:\programming\ffmpeg-20130606-git--win32-shared\bin to exe output path and run application.
UPD
Maybe you need to copy some of the following libraries from Qt\5.0.2\mingw47_32\bin\:
libgcc_s_sjlj-1.dll
libstdc++-6.dll
libwinpthread-1.dll