【问题标题】:Error building TMXParser using CMake使用 CMake 构建 TMXParser 时出错
【发布时间】:2015-11-18 18:03:47
【问题描述】:

我正在尝试在 Visual Studio 2013 上构建它。我为 ZLIB 和 TINYXML2 设置了包含和库路径,并使用 cmake 生成了项目。当我尝试构建它时,我收到以下错误:

1>------ Build started: Project: tmxparser, Configuration: Debug Win32 ------
2>------ Build started: Project: tmxparser_static, Configuration: Debug Win32 ------
1>cl : Command line error D8021: invalid numeric argument '/Werror=strict-prototypes'
2>cl : Command line error D8021: invalid numeric argument '/Werror=strict-prototypes'
3>cl : Command line error D8021: invalid numeric argument '/Werror'
5>------ Skipped Build: Project: INSTALL, Configuration: Debug Win32 ------
5>Project not selected to build for this solution configuration 
========== Build: 1 succeeded, 3 failed, 1 up-to-date, 1 skipped ==========

【问题讨论】:

  • /Werror=strict-prototypes 是 GCC/Clang 警告,Visual Studio 无法识别。您需要将其从 CMakeLists.txt 中删除。但是,如果您使用的是 this TMXParser,则文档状态:“放弃对 Android 和 Windows 的支持。如果您想要 Windows 版本,请使用 mxe。”
  • 我不知道 - 我从来没有听说过 :) wiki 中有一些文档可能会有所帮助 (github.com/mxe/mxe/wiki) 但我没有看到 CMakeLists.txt 或一个 Visual Studio .sln 文件,所以我猜你不能用 Visual Studio 构建它。也许你需要安装 MinGW 来构建它?
  • MXE 是一个在 Linux 等 Unix 系统上运行的交叉编译环境,它基于 MinGW 为 Windows 构建。所以我想在推荐你时,andrewrk 希望你在 Linux 上开发并从那里编译你的 Windows 版本。您可以在问题跟踪器上打开一个问题,询问是否支持在 on Windows 上编译。
  • 感谢您的帮助!

标签: c++ visual-studio-2013 cmake tmx


【解决方案1】:

您需要更改文件 CMakeList.txt 中的某些内容。

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

if (NOT USE_MINIZ)
    list(APPEND ${LIB_CFLAGS})
endif (NOT USE_MINIZ)

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

我成功构建了它。你可以在this link下载。

用法:

在 Visual Studio 中,您必须将 zlibd.lib 添加到

Project properties->Linker->input

【讨论】:

    猜你喜欢
    • 2014-04-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-25
    • 2017-09-16
    相关资源
    最近更新 更多