【问题标题】:Apparent ambiguity error with std::vector but it still compilesstd::vector 出现明显的歧义错误,但仍可编译
【发布时间】:2018-09-25 15:13:59
【问题描述】:

我正在用 Vulkan 编写一个项目,它可以编译并运行良好。代码和往常一样,但是在一些软件更新(Steam、Visual Studio 等)之后,出现了一个错误。

我提到了蒸汽,因为它导致了一个单独的运行时错误。与此处相同的错误:https://www.reddit.com/r/vulkan/comments/8ybq6f/need_some_help_debugging/e29qptx/

不管怎样,行:

const std::vector<const char*> validationLayers = { "VK_LAYER_LUNARG_standard_validation" };

类似的使用std::vectorstd::array 给我错误:Ambiguous symbol 'const std::vector&lt;const char*&gt;'

我的包含和定义如下:

#define GLFW_INCLUDE_VULKAN
#define GLM_FORCE_RADIANS
#define STB_IMAGE_IMPLEMENTATION

#include <glfw3.h>
#include <glm.hpp>
#include <gtc/matrix_transform.hpp>
#include <stb/stb_image.h>

#include <iostream>
#include <stdexcept>
#include <functional>
#include <vector>
#include <set>
#include <algorithm>
#include <fstream>
#include <string>
#include <array>
#include <chrono>

#ifdef NDEBUG
const bool enableValidationLayers = false;
#else
const bool enableValidationLayers = true;
#endif

因此,如果有办法抑制这个特定的错误突出显示,或者如果存在真正的冲突,我很想知道它在哪里/如何做到这一点。

就像我说的,它仍然运行良好,但是看着我的滚动条并看到一堆红色标记,通常表明我的程序没有编译,这很烦人。

【问题讨论】:

  • 你的意思是智能感知显示错误? Visual Studio 的哪个版本?
  • @AlanBirtles 是的,智能感知。我在 CE 2017, 15.8.5 我也刚刚发现当我将语言标准设置为 C++14 时我没有收到错误
  • intellisense 不是一个完整的编译器,总有一些边缘情况会失败,将其报告给微软并过滤掉 intellisense 错误,直到他们修复它stackoverflow.com/questions/14713391/…
  • 对我来说还不清楚是什么问题。我没有看到 vulcan 与该问题有关。此外,在Ambiguous symbol 的情况下,至少应指出两个符号,以便清楚导致歧义的原因。
  • 哦,看来问题出在 ReSharper 上,毕竟不是智能感知。还是谢谢你。

标签: c++ c++17


【解决方案1】:

这原来是我使用的 ReSharper 版本的问题。这里也有报道:https://resharper-support.jetbrains.com/hc/en-us/community/posts/360000430159-Intellisense-issue-with-C-17-standard?flash_digest=bbcceaf4d5a9c12c634a59aba32fc2143a325734

解决办法是关掉或者升级到R++ 2018.2

【讨论】:

    猜你喜欢
    • 2015-01-04
    • 1970-01-01
    • 1970-01-01
    • 2022-12-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-23
    相关资源
    最近更新 更多