Determining if a file is parsed by Qt Creator (CUD

2019-04-17 11:32发布

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条回答
smile是对你的礼貌
2楼-- · 2019-04-17 12:28

Try

#ifdef Q_CREATOR_RUN
// ...
#endif
查看更多
登录 后发表回答