Opencl语法突出显示

发布于 2025-01-29 04:32:38 字数 92 浏览 3 评论 0原文

是否有人有解决Clion的OpenCL代码的语法突出显示的解决方案? 我将OpenCL源代码放在带有Extension .CL的文件中,并希望对此类文件进行语法突出显示。

Does anyone have a solution for syntax highlighting of OpenCL code for CLion?
I am placing the OpenCL source code in a file with the extension .cl and would like to have syntax highlighting for such files.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

奈何桥上唱咆哮 2025-02-05 04:32:38

在CLION中,您可以添加.cl文件为自定义文件类型并手动提供语法突出显示的OpenCL C关键字列表。

可以从A .cl文件加载OPENCL C代码的替代方案:将其嵌入C ++中,例如此 opencl-wrapper 。虽然naive 字符串文字会破坏语法突出显示,但有一种方法可以保留语法通过

#define R(...) std::string(" "#__VA_ARGS__" ")

字符串宏来突出显示,并使用 #define s for opencl c函数和关键字

In CLion you can add .cl files as custom file types and manually provide the list of OpenCL C keywords for syntax highlighting.

There is an alternative to loading the OpenCL C code from a .cl file at runtime: Embedding it right within C++, such as used in this OpenCL-Wrapper. While naive string literals would destroy syntax highlighting, there is a way to retain syntax highlighting with the

#define R(...) std::string(" "#__VA_ARGS__" ")

stringification macro and by using #defines for all the OpenCL C functions and keywords.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文