OpenCL编译错误C4996
OpenCL Compiler Error C4996
我是新手。我已经阅读了一些书籍,并尝试编译以下代码
#define __CL_ENABLE_EXCEPTIONS
#define __NO_STD_VECTOR
#define PROGRAM_FILE "blank.cl"
#define KERNEL_FUNC "blank"
//#define __MAX_DEFAULT_VECTOR_SIZE 100
#include <cstdio>
#include <fstream>
#include <iostream>
#include <iterator>
#ifdef Windows
#include <OpenCL/cl.hpp>
#else
#include <CL/cl.hpp>
#endif
using namespace std;
using namespace cl;
int main() {
// int n = 10;
vector<Platform> platforms;
vector<Device> devices;
try {
} catch (exception e) {
}
return 0;
}
但是它给了我很多错误。
大部分如下
Error 14 error C4996: 'cl::vector<char *,10>': was declared deprecated C:Program Files (x86)AMD APP SDK2.9includeCLcl.hpp 1138 1 Matrix_multilpy_C
有谁能帮我吗?我使用visual studio 2013来编码,我发现我的版本是openCL 1.2
谢谢。
这很简单:cl
名称空间提供了一个vector
类,由于您使用了using namespace cl;
,因此您将获得该类。
删除行,#include <vector>
,删除__NO_STD_VECTOR
定义,并简单地使用std::vector<cl::Device>
, std::vector<cl::Platform>
。std::vector
做所有需要的;由于某种原因或其他原因,OpenCL头文件用于提供自定义向量类,不应该再使用(我不知道为什么首先添加它)。
您也不应该使用std
命名空间。注意,一旦同时使用cl
和std
名称空间,代码就会失败,因为会突然出现两个向量类碰撞。所以说不!
相关文章:
- 警告处理为错误这里有什么问题
- "error: no matching function for call to"构造函数错误
- boost::进程间消息队列引发错误
- C++,OpenCV,尝试显示图像时"OpenCV(4.3.0) Error: Assertion failed (size.width>0 && size.height>0)"此错误
- 有关插入适配器的错误。[错误]请求从 'back_insert_iterator<vector<>>' 类型转换为非标量类型
- QT在错误的班级中寻找空位
- 冲刺错误"variable may be unsafe" (C4996)...选择?
- 视觉"如何修复错误 C4996:"_strupr":C++ 中的错误"
- [[弃用]]导致VS2017(错误C4996)中的构建故障
- STL VS13 C++:错误C4996未禁用
- Visual Studio 2015 错误 C4996"std::_Copy_impl":使用可能不安全的参数进行函数调用
- 错误 C4996:"std::_Copy_impl":使用可能不安全的参数进行函数调用
- 使用C++strtk会导致一个xutility错误C4996
- OpenCL编译错误C4996
- C4018,错误C4996和错误C4716 c++
- 错误C4996使用boost的例子
- 错误 C4996 C++客户端和服务器
- 错误 C4996 'fopen'未声明
- Visual Studio 2015 不会禁止显示错误 C4996
- 错误 C4996:"std::_Copy_impl":禁用它是否安全?