在CodeBlock上搭建OpenCL环境
大部分在windows下的OpenCL环境都是基于visual studio IDE开发环境。其实现在我也是在Visual Studio 2015下进行OpenCL环境开发的。但是Visual studio对于初学者太过臃肿,且如果你是基于C语言开发的,那么Visual Studio支持并不是很好。所以我尝试过CodeBlock下开发,并且一切顺利。
下载时选择带有mingw包,能省去很多步骤。省得自己在配置编译环境。
创建OpenCL的编译器
C/C++ linking (gcc/g++)
- In order to compile your OpenCL program you must tell the compiler to use the OpenCL library with the flag: –l OpenCL
- If the compiler cannot find the OpenCL header files (it should do) you must specify the location of the CL/ folder with the –I (capital “i”) flag
- If the linker cannot find the OpenCL runtime libraries (it should do) you must specify the location of the lib file with the –L flag
- Make sure you are using a recent enough version of gcc/g++ - at least v4.7 is required to use the OpenCL C++ API (which needs C++11 support)
使编译器支持C99
添加include文档
创建OpenCL工程
最终就这么轻松的搞定了。
居然给我做了个超级链接,哈哈,受宠若惊啊。。。
回复删除我只想默默的拜读您的博客!
回复删除您好,您的网站做的很不错,很漂亮,我已经收藏了,方便我随时访问.
回复删除谢谢~O(∩_∩)O
回复删除支持楼主,感谢分享
回复删除