Identifier is undefined Nsight Eclipse 5.5

In a project with many .cu files and a .h file, I have some constants defined in my main.cu like this (shown just one as example):


device constant unsigned int x[1];

#include “second.cu”

… some code…


In the file second.cu I am trying to use that constant, like this:


cudaMemcpyToSymbol(x, y, sizeof(xx));


But Eclipse is giving me the error: identifier “x” is undefined.

I noticed that #includes in my main.cu, like the header.h, I need to specifically add in all the .cu files again. Which produced some redefinition problems that I solved using #pragma once.

I am new to Eclipse in general, found some complains about the CDT regarding include files not being indexed. I tried the Index Rebuild/Update/Freshen/Re-resolve method that worked for some in this regard, but with no luck with my problems.

Also, tried disabling the ‘heuristic resolution of includes’ in Properties → Indexer. I thought I got it for a few moments but then the error showed up again.

Any ideas to solve this problem?