编译器无法在使用cmake配置的Visual Studio项目中执行C ++ 11指令 [英] Compiler failing on C++11 instructions in a Visual Studio project configured with cmake

查看:681
本文介绍了编译器无法在使用cmake配置的Visual Studio项目中执行C ++ 11指令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在带有Visual Studio 2012的64位Windows计算机上构建voxelterrain库(C ++,Ogre)。CMake似乎可以正常运行(请参见下面的输出)。当我尝试编译库时,收到几个错误。我不了解CMAKE,但我认为编译器无法正确解释C ++ 11。

I am trying to build the voxelterrain library (C++, Ogre) on a 64 bit Windows Machine with Visual Studio 2012. CMake seems to run without an error (see output below). When I try to compile the library I receive several errors. I have no idea about CMAKE but I assume that the compiler is not interpreting C++11 correctly.

例如:
此代码...

For example: this code ...

 template <class T>
    using weakPointer = std::weak_ptr<T>;

出现此错误:

error C2988: Unerkannte Vorlagendeklaration/-definition
error C2059: syntax error : 'using'
error C2143: syntax error : missing ';' before '{'
error C2447: '{': missing function header (old-style formal list?

此处为源和CMAKE文件:

here the source and CMAKE file:

VoxelTerrain库: http:// voxelterrain。 com / index.html

VoxelTerrain Library: http://voxelterrain.com/index.html

CMake文件: https://github.com/qwertzui11/voxelTerrain/blob/master/CMakeLists.txt

CMake输出:

The C compiler identification is MSVC 17.0.61030.0
The CXX compiler identification is MSVC 17.0.61030.0
Check for working C compiler using: Visual Studio 11 2012 Win64
Check for working C compiler using: Visual Studio 11 2012 Win64 -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working CXX compiler using: Visual Studio 11 2012 Win64
Check for working CXX compiler using: Visual Studio 11 2012 Win64 -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
 CMake Warning (dev) at CMakeLists.txt:20 (if):
  Policy CMP0054 is not set: Only interpret if() arguments as variables or
  keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  Quoted variables like "MSVC" will no longer be dereferenced when the policy
  is set to NEW.  Since the policy is not set the OLD behavior will be used.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at CMakeLists.txt:26 (elseif):
  Policy CMP0054 is not set: Only interpret if() arguments as variables or
  keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  Quoted variables like "MSVC" will no longer be dereferenced when the policy
  is set to NEW.  Since the policy is not set the OLD behavior will be used.
This warning is for project developers.  Use -Wno-dev to suppress it.

Boost version: 1.57.0
...
Looking for OGRE...
Found Ogre Xalafu (1.10.0) 
...
Performing Test COMPILER_HAS_DEPRECATED_ATTR
Performing Test COMPILER_HAS_DEPRECATED_ATTR - Failed
Performing Test COMPILER_HAS_DEPRECATED
Performing Test COMPILER_HAS_DEPRECATED - Success
...
Configuring done
Generating done

感谢您的帮助!

推荐答案

本文说,Visual Studio 2012不支持别名模板。

This article says that Visual Studio 2012 does not support alias templates.

尽管它们在Visual Studio 2013中受支持。

They are supported in Visual Studio 2013 though.

这篇关于编译器无法在使用cmake配置的Visual Studio项目中执行C ++ 11指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆