在项目中包含 glm 时声明冲突

问题描述 投票:0回答:0

我想探索 Vulkan 库,我正在做一个教程。我需要导入 glm。 我有以下错误:

/opt/homebrew/include/glm/detail/func_common.inl:585:14: error: target of using declaration conflicts with declaration already in scope                 using std::isnan;

我在使用 M1 处理器 (arm64) 的 MacOS 13 我将 Clion 与基础 CMAKE 一起使用

我的 CMAKE:

cmake_minimum_required(VERSION 3.24)
project(TestCube)

set(CMAKE_CXX_STANDARD 20)

find_package(Vulkan REQUIRED FATAL_ERROR)
find_package(glfw3 REQUIRED FATAL_ERROR)
find_library(Cocoa NAMES Cocoa)
find_package (glog 0.6.0 REQUIRED)
find_package(glm REQUIRED)

add_executable(TestCube main.cpp)

if (VULKAN_FOUND)
message(STATUS "Found Vulkan. Including and linking...")
target_link_libraries(${PROJECT_NAME}  Vulkan::Vulkan glfw ${Cocoa} glog::glog glm::glm)
endif(VULKAN_FOUND)

我的包括:

\#define GLFW_INCLUDE_VULKAN
\#include \<GLFW/glfw3.h\>
\#include \<GLFW/glfw3native.h\>
\#include \<glog/logging.h\>
\#include \<vulkan/vulkan.h\>
\#include \<iostream\>
\#include \<stdexcept\>
\#include \<cstdlib\>
\#include \<filesystem\>
\#include \<optional\>
\#include \<set\>
\#include \<fstream\>
\#include \<glm/glm.hpp\>

经过一些故障排除后,像 这样的一些导入正在工作

教程中需要导入glm/mat4x4.hpp>

导入时出现错误。

此外,错误仅在使用 Vulkan 链接库时出现

感谢回复

c++ cmake vulkan glm
© www.soinside.com 2019 - 2024. All rights reserved.