Score:0

Need help to get rid of libtorch header erros: conflicting declaration ‘constexpr const auto torch::...’

tz flag

Can't compile a simple libtorch C++ program ever since upgraded ubuntu to 21.10. Using QT Creator, tried several versions (Desktop QT 5.12.5, 5.15.2, 6.1.2, 6.2.1), both gcc & clang w/o sucess. Also tried ABI=0 libtorch version. Always getting the error: /usr/local/include/torch/csrc/api/include/torch/types.h:39: error: conflicting declaration ‘constexpr const auto torch::(kUInt8, kInt8, etc)’ Also tried from c++14 to 2a as well INCLUDEPATH += /usr/include/c++/10 w/o sucess

Config: TEMPLATE = app CONFIG += cmdline c++14 CONFIG += thread CONFIG += CUDA #CONFIG += c++14 console no_keywords CONFIG -= app_bundle CONFIG -= qt

QMAKE_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=1 QMAKE_LFLAGS += -INCLUDE:?warp_size@cuda@at@@YAHXZ QMAKE_LFLAGS += -Wl,--no-as-needed #QMAKE_LFLAGS += -Wl,--copy-dt-needed-entries

DEFINES += QT_DEPRECATED_WARNINGS DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0

INCLUDEPATH += /usr/include/c++/11 QMAKE_LIBDIR += /usr/lib/x86_64-linux-gnu

INCLUDEPATH += /usr/local/include/torch/csrc/api/include QMAKE_LIBDIR += /usr/local/lib

CONFIG += link_pkgconfig PKGCONFIG += mysqlclient PKGCONFIG += libcurl PKGCONFIG += libxml-2.0 PKGCONFIG += glib-2.0 PKGCONFIG += cuda-11.3 PKGCONFIG += cudart-11.3 PKGCONFIG += opencv4

LIBS += -ltorch LIBS += -ltorch_cpu -lc10 LIBS += -ltorch_cuda -lc10_cuda

user15285808 avatar
tz flag
I need to know if someone knows how to get rid of the libtorch header errors:
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.