how to uncompress .tar and lz4 file in qt? - qt

i make a application in Qt for extract zip , tar and lz4 files, So i use QuaZip and zlib library!
The step one (Qt cmd):
cd C:\Qt\zlib-1.2.8
mingw32-make -f win32/Makefile.gcc
and step two:
cd C:\Qt\quazip-0.7
qmake "CONFIG+=release" "INCLUDEPATH+=C:/Qt/zlib-1.2.8" "LIBS+=-LC:/Qt/zlib-
1.2.8 -lz"
mingw32-make
step three add below code to .pro in QT project:
INCLUDEPATH += C:/Qt/zlib-1.2.8
LIBS += -LC:/Qt/zlib-1.2.8 -lz
INCLUDEPATH += C:/Qt/quazip-0.7/quazip
LIBS += -LC:/Qt/quazip-0.7/quazip/release -lquazip
and the last step can unzip and zip file's like this code:
#include <JlCompress.h>
int main(int argc, char * argv[])
{
JlCompress::compressFile("C:/test.zip", "C:/test.txt");
JlCompress::extractDir("C:/test.zip", "C:/");
return 0;
}
Now my problem is i can't extract .tar and lz4 file's. please help me!

Related

How to fix 'LINK : fatal error LNK1181: cannot open input file 'Qt5Ftp.obj''?

I use Qt5.12.0, Qt Creator 4.8.0. So it doesn't contain QFtp but I need to use it. So I follow the way I found on the Internet, I put the .h, .lib, .prl, .dll files of Qt5Ftp to the corresponding directories in 'Qt\Qt5.12.0\5.12.0\msvc2017_64'. Then I built my project, the compiling process is successful, but there's an error in the linking process—
LINK : fatal error LNK1181: cannot open input file 'Qt5Ftp.obj'
I'd tried to rerun qmake, clean all, rebuild all, etc, everything I could try, but I still got this error.
Here's the content of the .pro file of my project—
QT += core gui network webenginewidgets
CONFIG += c++11
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
include(qtsingleapplication/src/qtsingleapplication.pri)
TARGET = YunQuBrowser
TEMPLATE = app
DEFINES += QT_DEPRECATED_WARNINGS
SOURCES += main.cpp\
mainwindow.cpp \
webview.cpp \
webpage.cpp \
ftpclient.cpp \
logfile.cpp \
cmdconfig.cpp
HEADERS += mainwindow.h \
webview.h \
webpage.h \
ftpclient.h \
logfile.h \
cmdconfig.h \
common.h
INCLUDEPATH += ./include
FORMS += mainwindow.ui
RESOURCES += \
YunQuBrowser.qrc \
RC_FILE = YunQuBrowserDesktopIcon.rc
CONFIG(debug, debug|release) {
LIBS += Qt5Ftpd
} else {
LIBS += Qt5Ftp
}
The last comment I post contains a mistake. The correct way is to change the whole CONFIG block into LIBS += -L"QFtp/qtftp_lib", which should be a directory, but not a path of a .lib file.

Qt5 OpenCV3.4.5 LNK1105 cannot open opencv_world345d.obj

I am building a Qt5 project with OpenCV3.4.5 in windows. The OpenCV is a prebuilt version with opencv_world345.lib and opencv_world345dlib. I create a .pri file for including opencv into the Qt project. Here below is for the opencv .pri file:
INCLUDEPATH += C:/opencv-3.4.5/prebuild/include \
C:/opencv-3.4.5/prebuild/include/opencv \
C:/opencv-3.4.5/prebuild/include/opencv2
Debug: {
LIBS += lc:/opencv-3.4.5/prebuild/x64/vc14/lib/opencv_world345d
}
Release: {
LIBS += lc:/opencv-3.4.5/prebuild/x64/vc14/lib/opencv_world345
}
I also set C:\opencv-3.4.5\prebuild\x64\vc14\bin in the path of systems variables.
Building the project in debug mode gives the error: LINK : fatal error LNK1104: cannot open file 'lc:\opencv-3.4.5\prebuild\x64\vc14\lib\opencv_world345d.obj'.
What causes the error? Do I miss something else in configuring opencv for Qt?
Have you run qmake since making your changes to the .pri file?
Normally I would have asked for clarification in the comments, but I'm new to Stack Overflow and don't have 50 reputation yet.
EDIT:
I found an old project of mine that I have OpenCV3.1.0 properly linked to. Here's what I have in my .pro
LIBS += -L*PATH TO OPEN CV*/OpenCV-3.1.0/lib
INCLUDEPATH += *PATH TO OPEN CV*/OpenCV-3.1.0/include
CONFIG(release, debug|release):{
LIBS += \
-lopencv_world310
}
CONFIG(debug, debug|release):{
LIBS += \
-lopencv_world310d
}
Here below is the modified .pri file that works for me!
INCLUDEPATH += c:/opencv-3.4.5/prebuild/include
CONFIG(release, debug|release):{
LIBS += -L"c:/opencv-3.4.5/prebuild/x64/vc14/lib" -lopencv_world345
}
CONFIG(debug, debug|release):{
LIBS += -L"c:/opencv-3.4.5/prebuild/x64/vc14/lib" -lopencv_world345d
}
The configurations by Debug:{} and Release {} do not work!

boost/config.hpp: No such file or directory

I downloaded a project named MVCClone from github. It's a QT project that needs CGAL to run. I installed boost and CGAL on my Windows 10. QT 5.5.1 mingw is installed.
When I build the project I get the error:
boost/config.hpp: No such file or directory
in one of CGAL header files.
Here is the .pro file for QT project:
QT += core gui opengl
TARGET = MVCDemo
TEMPLATE = app
SRC_DIR = $${PWD}/src
SOURCES += $${SRC_DIR}/glwidget.cpp \
$${SRC_DIR}/main.cpp \
$${SRC_DIR}/mainwindow.cpp \
$${SRC_DIR}/MVCCloner.cpp \
$${SRC_DIR}/sourcewidget.cpp \
$${SRC_DIR}/utils.cpp
HEADERS += $${SRC_DIR}/CloningParameters.h \
$${SRC_DIR}/CoordinatesMesh.h \
$${SRC_DIR}/glwidget.h \
$${SRC_DIR}/mainwindow.h \
$${SRC_DIR}/mvcshaders.h \
$${SRC_DIR}/MVCCloner.h \
$${SRC_DIR}/sourcewidget.h \
$${SRC_DIR}/utils.h
## using pkg-config
#linux {
# CONFIG += link_pkgconfig
# PKGCONFIG += glu
#}
# CGAL
*-g++* {
QMAKE_CXXFLAGS += -frounding-math
}
LIBS += -lCGAL -lgmp
RESOURCES += images/images.qrc \
src/shaders.qrc
LIBS += "C:/dev/CGAL-4.8.1/lib/release/CGAL_Core-vc140-mt-4.8.1.lib"
INCLUDEPATH += "C:/dev/CGAL-4.8.1/include"
LIBS+="C:\local\boost_1_61_0\lib64-msvc-14.0"
INCLUDEPATH +="C:/local/boost_1_61_0/lib64-msvc-14.0"
Also I can't #include any boost headers in the project.
INCLUDEPATH +="C:/local/boost_1_61_0/lib64-msvc-14.0"
should be:
INCLUDEPATH +="C:/local/boost_1_61_0/"
there you will find a folder named boost containing all headers.

Compiling C++ AMP using qmake fails

I have the following main.cpp file:
#include <amp.h>
using namespace concurrency;
int main()
{
int arr[] = {42};
array_view<int, 1> v(1, arr);
return 0;
}
and a .pro file:
TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt
QMAKE_CXXFLAGS += -EHsc
SOURCES += main.cpp
If I compile main.cpp from the Visual Studio 2012 command line (just using cl /EHsc main.cpp), everything works fine. But if I use qmake and nmake there is alway a link error, that there are unresolved external symbols (coming from amp). Does anybody know how to resolve this problem?
I figured out, what the problem is: In the mkspec file qmake.conf the compiler flag Zc:wchar_t- causes the compiler to translate some types relatet to wchar_t incorrectly and hence the resulting symbols could not be resolved.
To solve this problem, change the above .pro file to
TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt
QMAKE_CXXFLAGS += -EHsc -Zc:wchar_t
SOURCES += main.cpp
(add -Zc:wchar_t to QMAKE_CXXFLAGS).
You forget to add
LIBS += -lname_of_the_amp_lib
Sorry but I don't know the name of the lib...

QT ffmpeg Setting

I can't use the ffmpeg in QT.
My Steps :
-1. compile the ffmpeg as normal
-2. add lib/include path in QT .pro
LIBS += -L/home/kim/ffmpeg/lib -lavcodec -lavformat
INCLUDEPATH += /home/kim/ffmpeg/include
-3. in code
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
}
and just call a function named av_register_all();
then I got the following bulid issues< many functions undefined reference >
in function `rl2_read_packet`: undefined reference to `av_free_packet`
in function `av_register_all`: ....
I search a solution of the problem but not work for me.
Any other solution? Thanks.
This is an old post and it is almost solved. By the way, I faced to the problem and I had lots of time struggling with
undefined reference to av_register_all
I am using Qt Creator 5.3.2 and this is my MYPROJECT.pro file
MYPROJECT.pro
QT += core
QT -= gui
TARGET = MYPROJECT
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
QMAKE_CXXFLAGS += -D__STDC_CONSTANT_MACROS
LIBS += -LC:\ffmpeg-20151219-git-2dba040-win32-dev\lib
LIBS += -lavcodec -lavformat -lavutil -lswscale
INCLUDEPATH +=C:\ffmpeg-20151219-git-2dba040-win32-dev\include
Setting up project.pro
It is recommended to build ffmpeg from scratch, but if you are on windows and if you are not willing to compile this masterpiece, then congrats! you are like me! Go for pre-built in zereanoe and download both the latest shared and dev win-32 versions. Extract the latter two packages in a place where there is no spaces in the path, i.e. mine is in: C:\ffmpeg-20151219-git-2dba040-win32-dev
I recommend that don't rename the main folder because it is highly informative. Set the include folder of the [PATH TO ffmpg-YYYYMMDD-git-win32-dev]/include to your project's search space by the following line of code:
INCLUDEPATH +=C:\ffmpeg-20151219-git-2dba040-win32-dev\include
You should also use libraries in [PATH TO ffmpeg-YYYYMMDD-git-win32-dev]/lib to your project as below:
LIBS += -LC:\ffmpeg-20151219-git-2dba040-win32-dev\lib
LIBS += -lavcodec -lavformat -lavutil
You can call libraries other than lavcodec, lavformat and lavutil. In your cpp file you should enclose headers corresponding to ffmpeg in extern "C" block.
DLLs should be added
The final step is to add all the dll files in the shared version of ffmpeg that you have recently downloaded.
Copy *.dll files within
[PATH TO ffmpeg-YYYYMMDD-git-2dba040-win32-shared]/bin
and paste them wherever your executable exists. Fo instance, my project is located on C:/QtProjects/MYPROJECT, then my binaries are located on:
C:/QtProjects/build-MYPROJECT-Desktop_Qt_5_3_MinGW_32bit-Debug
Now, copy all the dlls to your project's debug or release folder.
My main.cpp
This is my main.cpp :
main.cpp
#include <iostream>
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
}
using namespace std;
int main(int argc, char *argv[])
{
cout<<"I have included FFMPEG in my project"<<endl;
av_register_all();
cout<<"If everything goes well you will see ME"<<endl;
return 0;
}
I had the same problems, it worked using the following trick.
In code cpp source:
#define __STDC_CONSTANT_MACROS
extern "C" {
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
}
And in your .pro file:
LIBS += -LC:/Users/tom/bla/ffmpeg/lib/ -lavcodec -lavformat -lavutil
I think in your case, you need the -lavutil lib parameter.

Resources