Determining if a file is parsed by Qt Creator (CUDA Syntax highlighting)

a 夏天 提交于 2019-12-06 14:57:44

问题


I switched recently from Visual Studio to Qt Creator. I am still using the Visual Studio Compiler on Windows as CUDA has this as a dependency. CUDA uses some functions and keywords that are only valid when compiled by nvcc, so I did a workaround in Visual Studio to enable syntax highlighting for CUDA files:

#pragma once

#ifdef __INTELLISENSE__

#include <cuda.h>
#include <cuda_runtime.h>
#include <device_launch_parameters.h>

#define __CUDACC__

#include <device_functions.h>

#endif

This works in Visual Studio as the preprocessor macro __INTELLISENSE__ is only defined when Visual Studio itself parses the file, not during compilation. Now I wanted to know if there is also a macro that Qt Creator defines during parsing so that this workaround for coding CUDA still works.

Thanks Sven


回答1:


Try

#ifdef Q_CREATOR_RUN
// ...
#endif


来源:https://stackoverflow.com/questions/28322961/determining-if-a-file-is-parsed-by-qt-creator-cuda-syntax-highlighting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!