While compiling this hello world sample in Ubuntu 10.10
This is from CUDA by Example, chapter 3 (No compile instructions provided >:@)
#include
The issue is that the compiler does not know where to find printf
function. It
needs to know where to find it. The include
directive is used to tell the compiler where to find it.
#include "stdio.h"
int main(void) {
printf("Hello World!\n");
return 0;
}
After the fix, it would work:
$ nvcc hello_world.cu
$ ls
a.out hello_world.cu
$ a.out
Hello World!