Код: Выделить всё
CMake Warning (dev) in CMakeLists.txt:No project() command is present. The top-level CMakeLists.txt file mustcontain a literal, direct call to the project() command. Add a line ofcode such as
project(ProjectName)
near the top of the file, but after cmake_minimum_required().
CMake is pretending there is a "project(Project)" command on the firstline.This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) in CMakeLists.txt:cmake_minimum_required() should be called prior to this top-level project()call. Please see the cmake-commands(7) manual for usage documentation ofboth commands.This warning is for project developers. Use -Wno-dev to suppress it.
CMakeLists.txt
Код: Выделить всё
project(test)set(CMAKE_PREFIX_PATH /home/bao/Downloads/libtorch-shared-with-deps-2.5.0+cpu/libtorch)find_package(Torch REQUIRED)set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}")
add_executable(${PROJECT_NAME} example-app.cpp)target_link_libraries(${PROJECT_NAME} "${TORCH_LIBRARIES}")set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14)
Код: Выделить всё
#include
int main(){std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79129008/torch-c-program-failed-to-compiled-with-weird-errors[/url]