nvcc compiler can not tell me even if an external device variable has been defined.
nvcc compiler can not tell me the error even if an external device variable has been defined.
For example,
I have the following code,
File: test1.cu
[codebox]
#include <stdio.h>
device constant extern int Adev;
global void test(void)
{
int B;
B=Adev;
}
int main(void)
{
test<<<1,1>>>();
return 0;
}
[/codebox]
The file can be compiled into an executable file a.exe
nvcc test1.cu
But in fact, as the definiton of external device variable has been defined yet, the executable file a.exe should be incorrect.
In contract, if the host side external is not defined, the compiler will tell me the error and will not generate an executable file.
File: test2.cu
[codebox]
#include <stdio.h>
extern int A;
int main(void)
{
A=1234;
return 0;
}
[/codebox]
Anyone can tell me why and how make the nvcc also tell me the error if I forget the definiton of an external device variable.
Thank you in advance.