gpt4 book ai didi

c++ - Wl,--stack,4194304 错误 Visual Studio/CMake

转载 作者:行者123 更新时间:2023-11-28 04:44:29 25 4
gpt4 key购买 nike

所以我使用 CMake 构建了一个开源项目并在 Visual Studio 中打开它,但我收到此错误:

Command line error D8021: invalid numeric argument '/Wl,--stack,4194304'

我的 CMakeLists.txt 有这个:

if(WIN32) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--stack,4194304 -fpermissive") endif()

我不确定这是什么或如何修复。感谢任何帮助

最佳答案

您正在为 GCC 提供 Visual Studio 编译器开关。

if (WIN32)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--stack,4194304 -fpermissive")
elseif(MSVC)
# add options for Visual C/C++ Compiler here
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /F 4194304")
endif()
endif()

另见 In cmake, how can I test if the compiler is Clang?如何可靠地识别您的编译器。

有关许可标志,请参阅 Visual Studio (2015) fpermissive equivalent flag .

编辑:根据讨论为 GCC 添加了更可靠的编译器检查。

关于c++ - Wl,--stack,4194304 错误 Visual Studio/CMake,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49547268/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com