NVCC compiler can not check if external device variables exsits/

It seems that the NVCC compiler can not check if external device variables really exsits.

For example, the following single file only denots an external device variable named ADEV, but no definition file is supplied. But when I comile the single file test.cu.

The compiler can generate executable file named a.exe.

Example source: test.cu

[codebox]

#include <stdio.h>

extern device constant int ADEV;

global void test(void)

{

int B;

B=ADEV;

}

int main(void)

{

int A;

int ierr;

A=1234;

ierr=cudaMemcpyToSymbol("ADEV",&A,sizeof(int));

printf("cudaMemcpyToSymbol return ierr=%d \n",ierr);

test<<<1,1>>>();

return 0;

}

[/codebox]

In contrast, if it is on host side, this un-defined variables can be pointed out and can not generate the exe file.

[codebox]

#include <stdio.h>

extern int A;

int main(void)

{

A=1234;

return 0;

}

[/codebox]

Anyone can tell me why and how can I let the nvcc compiler tell me if one external variable has been defined.

Thank you in advance.

deja-vu. Please don’t cross-post. It is really annoying to read the same thing over again.

I am really so sorry to make anybody annoying

I encountered a web page error when I am posting the last one.

I had to post again but I dont know it had been posted agon.

I am very sorry.

Can any one or administrator can delete this thread topic for me?

Thank you.