I need some help in compiling the examples in the book which involve CUDA - OpenGL interoperability { heat.cu in chapter 8 }. i have tried to compile the code using
nvcc heat.cu -o heat
but i am getting a ton of errors thrown at me. I think i am missing out some compiler options which should take care of the openGL part. Can someone tell how to compile it from terminal in ubuntu ?
Error from compiling:
/Desktop/Cuda_Codes/Cuda_by_example/chapter08$ nvcc heat.cu -o heat
../common/gpu_anim.h(61): warning: conversion from a string literal to "char *" is deprecated
../common/gpu_anim.h(61): warning: conversion from a string literal to "char *" is deprecated
/tmp/tmpxft_00002690_00000000-16_heat.o: In function `GPUAnimBitmap::GPUAnimBitmap(int, int, void*)':
tmpxft_00002690_00000000-3_heat.cudafe1.cpp:(.text._ZN13GPUAnimBitmapC2EiiPv[_ZN13GPUAnimBitmapC5EiiPv]+0x103): undefined reference to `glutInit'
tmpxft_00002690_00000000-3_heat.cudafe1.cpp:(.text._ZN13GPUAnimBitmapC2EiiPv[_ZN13GPUAnimBitmapC5EiiPv]+0x10d): undefined reference to `glutInitDisplayMode'
tmpxft_00002690_00000000-3_heat.cudafe1.cpp:(.text._ZN13GPUAnimBitmapC2EiiPv[_ZN13GPUAnimBitmapC5EiiPv]+0x12a): undefined reference to `glutInitWindowSize'
tmpxft_00002690_00000000-3_heat.cudafe1.cpp:(.text._ZN13GPUAnimBitmapC2EiiPv[_ZN13GPUAnimBitmapC5EiiPv]+0x134): undefined reference to `glutCreateWindow'
tmpxft_00002690_00000000-3_heat.cudafe1.cpp:(.text._ZN13GPUAnimBitmapC2EiiPv[_ZN13GPUAnimBitmapC5EiiPv]+0x13e): undefined reference to `glXGetProcAddress'
/tmp/tmpxft_00002690_00000000-16_heat.o: In function `GPUAnimBitmap::anim_and_exit(void (*)(uchar4*, void*, int), void (*)(void*))':
E[_ZN13GPUAnimBitmap13anim_and_exitEPFvP6uchar4PviEPFvS2_E]+0x67): undefined reference to `glutMouseFunc'
tmpxft_00002690_00000000-3_heat.cudafe1.cpp:(.text._ZN13GPUAnimBitmap13anim_and_exitEPFvP6uchar4PviEPFvS2_E[_ZN13GPUAnimBitmap13anim_and_exitEPFvP6uchar4PviEPFvS2_E]+0x71): undefined reference to `glutIdleFunc'
tmpxft_00002690_00000000-3_heat.cudafe1.cpp:(.text._ZN13GPUAnimBitmap13anim_and_exitEPFvP6uchar4PviEPFvS2_E[_ZN13GPUAnimBitmap13anim_and_exitEPFvP6uchar4PviEPFvS2_E]+0x76): undefined reference to `glutMainLoop'
/tmp/tmpxft_00002690_00000000-16_heat.o: In function `GPUAnimBitmap::idle_func()':
tmpxft_00002690_00000000-3_heat.cudafe1.cpp:(.text._ZN13GPUAnimBitmap9idle_funcEv[_ZN13GPUAnimBitmap9idle_funcEv]+0xbe): undefined reference to `glutPostRedisplay'
/tmp/tmpxft_00002690_00000000-16_heat.o: In function `GPUAnimBitmap::Draw()':
tmpxft_00002690_00000000-3_heat.cudafe1.cpp:(.text._ZN13GPUAnimBitmap4DrawEv[_ZN13GPUAnimBitmap4DrawEv]+0x26): undefined reference to `glClearColor'
tmpxft_00002690_00000000-3_heat.cudafe1.cpp:(.text._ZN13GPUAnimBitmap4DrawEv[_ZN13GPUAnimBitmap4DrawEv]+0x30): undefined reference to `glClear'
tmpxft_00002690_00000000-3_heat.cudafe1.cpp:(.text._ZN13GPUAnimBitmap4DrawEv[_ZN13GPUAnimBitmap4DrawEv]+0x55): undefined reference to `glDrawPixels'
tmpxft_00002690_00000000-3_heat.cudafe1.cpp:(.text._ZN13GPUAnimBitmap4DrawEv[_ZN13GPUAnimBitmap4DrawEv]+0x5a): undefined reference to `glutSwapBuffers'
collect2: error: ld returned 1 exit status