Problem with compiling a CUDA code in Eclipse

With CUDA-11.6 and Eclipse 4.21, I have created a CUDA project and added a .cu file with a simple CUDA code. As you can see in the picture below, all cuda functions are not recognized. Also, by building the project, I get an “undefined reference to main()” error which is weird.

If I use terminal and run

nvcc -o test -arch=sm_86 -g -G

Everything is fine. Any idea on how to fix that?