Problem when using Libtorch with Qt
-
Hi all,
I would like to use the PyTorch C++ distribution "libtorch" with my Qt application. I have Qt 5.9.5 and Ubuntu 18.04.
First, I downloaded and unzipped the libtorch library using the below Pytorch selection.Then, I created a basic Qt application where I added the necessary flags and library paths in the .pro file, as shown below.
I build and run the basic code below:
However, I got the following errors:
What is the issue because I consider that I added all the necessary flags and paths ??
-
Hi all,
I would like to use the PyTorch C++ distribution "libtorch" with my Qt application. I have Qt 5.9.5 and Ubuntu 18.04.
First, I downloaded and unzipped the libtorch library using the below Pytorch selection.Then, I created a basic Qt application where I added the necessary flags and library paths in the .pro file, as shown below.
I build and run the basic code below:
However, I got the following errors:
What is the issue because I consider that I added all the necessary flags and paths ??
-
@ZINE then I would recommend to keep using CMake and build your Qt project with it especially since qmake has been deprecated with Qt 6.
Otherwise, check the flags used by cmake. Also note that the example uses C++14, something that you did not activate in your qmake project.
-
@ZINE then I would recommend to keep using CMake and build your Qt project with it especially since qmake has been deprecated with Qt 6.
Otherwise, check the flags used by cmake. Also note that the example uses C++14, something that you did not activate in your qmake project.
Which of these two torch libs did you download? According to your pro-file (QMAKE_CXXFLAGS += -DGLIBCXX_USE_CXX_ABI=0) it must be the first one (Pre-cxx11 ABI)
-
@ZINE then I would recommend to keep using CMake and build your Qt project with it especially since qmake has been deprecated with Qt 6.
Otherwise, check the flags used by cmake. Also note that the example uses C++14, something that you did not activate in your qmake project.
@SGaist I build similar example that uses C++ 17 and it works fine with CMake.
How to activate C++14 in the qmake project ?
How to use CMake to build a Qt project ? Is there a way in Qt to automate the creation of CMakeLists.txt (packages, sources ...etc) and use CMake to build Qt project ?
-
Which of these two torch libs did you download? According to your pro-file (QMAKE_CXXFLAGS += -DGLIBCXX_USE_CXX_ABI=0) it must be the first one (Pre-cxx11 ABI)
@Christian-Ehrlicher Yes, it is the first one that I used.
-
@Christian-Ehrlicher Yes, it is the first one that I used.
@ZINE But why? Remove this crappy define and use the correct lib with correct cxxabi support.
-
@ZINE But why? Remove this crappy define and use the correct lib with correct cxxabi support.
-