Compiler failing on C++11 instructions in a Visual Studio project configured with cmake

无人久伴 提交于 2019-12-13 19:17:08

问题


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>;

gives this error:

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?

here the source and CMAKE file:

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

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

CMake output:

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

Thanks for your help!


回答1:


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

They are supported in Visual Studio 2013 though.



来源:https://stackoverflow.com/questions/29624885/compiler-failing-on-c11-instructions-in-a-visual-studio-project-configured-wit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!