cuda by example julia example error Cannot compile example at: CPUBitmap::display_and_exit(void (*)(

Hello.

I’ve been making my way through the CUDA by example book but hit a snag.

I can’t compile the julia code in Chapter 4 page 47.

I get the following error each time:

/tmp/tmpxft_00006c46_00000000-12_julia_cpu.o: In function `CPUBitmap::display_and_exit(void (*)(void*))':

tmpxft_00006c46_00000000-1_julia_cpu.cudafe1.cpp:(.text._ZN9CPUBitmap16display_and_exitEPFvPvE[CPUBitmap::display_and_exit(void (*)(void*))]+0x48): undefined reference to `glutInit'

tmpxft_00006c46_00000000-1_julia_cpu.cudafe1.cpp:(.text._ZN9CPUBitmap16display_and_exitEPFvPvE[CPUBitmap::display_and_exit(void (*)(void*))]+0x52): undefined reference to `glutInitDisplayMode'

tmpxft_00006c46_00000000-1_julia_cpu.cudafe1.cpp:(.text._ZN9CPUBitmap16display_and_exitEPFvPvE[CPUBitmap::display_and_exit(void (*)(void*))]+0x65): undefined reference to `glutInitWindowSize'

tmpxft_00006c46_00000000-1_julia_cpu.cudafe1.cpp:(.text._ZN9CPUBitmap16display_and_exitEPFvPvE[CPUBitmap::display_and_exit(void (*)(void*))]+0x6f): undefined reference to `glutCreateWindow'

tmpxft_00006c46_00000000-1_julia_cpu.cudafe1.cpp:(.text._ZN9CPUBitmap16display_and_exitEPFvPvE[CPUBitmap::display_and_exit(void (*)(void*))]+0x79): undefined reference to `glutKeyboardFunc'

tmpxft_00006c46_00000000-1_julia_cpu.cudafe1.cpp:(.text._ZN9CPUBitmap16display_and_exitEPFvPvE[CPUBitmap::display_and_exit(void (*)(void*))]+0x83): undefined reference to `glutDisplayFunc'

tmpxft_00006c46_00000000-1_julia_cpu.cudafe1.cpp:(.text._ZN9CPUBitmap16display_and_exitEPFvPvE[CPUBitmap::display_and_exit(void (*)(void*))]+0x88): undefined reference to `glutMainLoop'

/tmp/tmpxft_00006c46_00000000-12_julia_cpu.o: In function `CPUBitmap::Draw()':

tmpxft_00006c46_00000000-1_julia_cpu.cudafe1.cpp:(.text._ZN9CPUBitmap4DrawEv[CPUBitmap::Draw()]+0x26): undefined reference to `glClearColor'

tmpxft_00006c46_00000000-1_julia_cpu.cudafe1.cpp:(.text._ZN9CPUBitmap4DrawEv[CPUBitmap::Draw()]+0x30): undefined reference to `glClear'

tmpxft_00006c46_00000000-1_julia_cpu.cudafe1.cpp:(.text._ZN9CPUBitmap4DrawEv[CPUBitmap::Draw()]+0x57): undefined reference to `glDrawPixels'

tmpxft_00006c46_00000000-1_julia_cpu.cudafe1.cpp:(.text._ZN9CPUBitmap4DrawEv[CPUBitmap::Draw()]+0x5c): undefined reference to `glFlush'

collect2: ld returned 1 exit status

I’ve noticed that the book says CPUBitmap bitmap(DIM, DIM); but this seems to differ from the function in the downloadable source code for the book.

In case it matters here are my system specs:

Fedora 12 64bit

GCC 4.4.4

GCC 4.3.0

GCC 4.2.2

CUDA SDK 3.1

I can’t get the code to compile with any of the GCC compilers (I’ve installed them all in hopes of getting at least one of them to work).

Can anyone help?

Any and all help is appreciated.

Thanks

It’s not finding the libglut library during linking. Add -lglut to the compile command:

nvcc -o julia_gpu julia_gpu.cu -lglut

It’s not finding the libglut library during linking. Add -lglut to the compile command:

nvcc -o julia_gpu julia_gpu.cu -lglut

Thanks!

That did the trick.

Thanks!

That did the trick.

Hello,

When I run the Julia GPU code. I find error as…

JuliaSet.cu(54): error: identifier “CPUBitmap” is undefined

hello,

I’m facing the same problem, when I run the Julia GPU code, I find error as…

gpujulia.cu(75): error: identifier “CPUBitmap” is undefined