visual Ambiguous statements c++ -AMP:(extent)是不明确的
visual Ambiguous statements C++-AMP: (extent) is ambiguous
我试图在c++ -AMP中编写代码,将多个2D矢量复制到GPU内存中进行处理。然而,一旦我从表达式extent<2> eM(100,100);
开始,我就会遇到这个错误:"范围"是模糊的。是否与c++中的其他extent表达式有冲突?是因为我使用的库吗?这些是我包含的所有库和命名空间,我不能包含代码,因为它很长,会让人困惑。
#include "stdafx.h"
#include <Windows.h>
#include <stdint.h>
#include <amp.h>
#include <Shlwapi.h>
#include <vector>
#include <random>
#include <iostream>
using std::endl;
using std::cout;
#include <iomanip>
#include "timer.h"
#include <fstream>
using std::ifstream;
#include <cstring>
#include <sstream>
#include <tchar.h>
using namespace std;
using namespace concurrency;
using std::vector;
该消息意味着编译器无法判断您是想要std::extent
还是concurrency::extent
。有三种方法可以解决这个问题:
- 删除
#include
带来的std::extent
-这是不太可能是一个很好的解决方案,因为你可能需要的东西从头 - 使用
concurrency::extent
时使用其全名-尴尬,但会工作 - 删除
using namespace std;
并将其替换为单个语句,如using std::endl;
,如您在#include
语句中看到的。
我最喜欢最后一个,虽然它需要更多的工作。找出需要哪些工具的最佳方法是删除using namespace std;
并进行编译。错误消息将告诉您正在使用std中的哪些类型。
相关文章:
- Visual C++(VS2017)中用户定义的转换不明确
- 重载类方法的不明确调用
- 为函数定义符号不明确的指针参数
- 父类的私有函数会导致对具有相同名称和相似参数的子类中的公共函数的不明确调用
- 在 C++17 中的命名空间和子命名空间中重载运算符是不明确的
- C++ 编译器错误:P1LinkedList.cpp:145:错误:重载的"to_string(int&)"调用不明确
- 对重载函数find_first_not_of的不明确调用
- 不明确的成员模板查找
- gcc出现不明确的模板实例化错误
- 调用'Node'构造函数是不明确的
- 如何解决不明确的运算符过载问题?
- 使用 nullptr 调用重载方法是不明确的
- "fpclassify":对重载函数的不明确调用
- 对"列表"的引用不明确,包括头文件
- 删除全局隐式函数 - 避免使用不明确的运算符
- 当接收到不明确的规范时,表示图的邻接列表的数据结构
- "byte":使用Crypto++和Windows SDK时出现不明确的符号错误
- 使用 std::iterator_traits<> 时编译时错误不明确
- 不明确的函数模板
- visual Ambiguous statements c++ -AMP:(extent)是不明确的