使用MSYS2使用ITK库时的链接错误2

发布于 2025-01-18 18:59:01 字数 780 浏览 1 评论 0原文

我希望使用Windows下的MSYS2使用ITK编译程序。当我使用Cmake生成Makefile时,我会收到此错误。

CMake Error at CMakeLists.txt:36 (target_link_libraries):
Target "itkComparaison" links to:

GTest::GTest

but the target was not found.  Possible reasons include:

* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.

有了这个cmakelists,

cmake_minimum_required(VERSION 3.16)

project(itkComparaison)
find_package(ITK REQUIRED)
include(${ITK_USE_FILE})

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

add_executable(
    itkComparaison
    main.cpp
    ....h
    ....cpp
)

find_package(ITK CONFIG REQUIRED)

target_link_libraries(itkComparaison ${ITK_LIBRARIES})

您曾经遇到过这个错误吗?

I am looking to compile a program using ITK with MSYS2 under Windows. When I generate my makefile with CMAKE, I get this error.

CMake Error at CMakeLists.txt:36 (target_link_libraries):
Target "itkComparaison" links to:

GTest::GTest

but the target was not found.  Possible reasons include:

* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.

with this CMakeLists

cmake_minimum_required(VERSION 3.16)

project(itkComparaison)
find_package(ITK REQUIRED)
include(${ITK_USE_FILE})

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

add_executable(
    itkComparaison
    main.cpp
    ....h
    ....cpp
)

find_package(ITK CONFIG REQUIRED)

target_link_libraries(itkComparaison ${ITK_LIBRARIES})

Have you ever encountered this error?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文