I have cuda 2.1 installed on my RedHat Enterprise Linux Server 5.2 and is working well. I have a Nvidia Quadro FX 1800 graphics card (compute capability 1.1).
However, I am having problems compiling cuda programs using OpenGL.
[I also have the following installed on my machine -
freeglut-2.4.0.7.1
libX11-1.0.3-9]
I am trying to compile a sample program which uses OpenGL to draw something on the screen (It is the example julia_gpu.cu which comes as a part of source code with the book Cuda By Example)
When I try to compile the file like this -
nvcc -lglut julia_cpu.cu
I get the following error -
In file included from ../common/cpu_bitmap.h:20,
from julia_gpu.cu:18:
../common/gl_helper.h:44:21: error: GL/glut.h: No such file or directory
But the file GL/glut.h actually exists in the same folder as gl_helper.h (I don`t know why it is not able to find it)
So then I edited the file gl_helper.h and tried to fix the problem by editing the line
#include<GL/glut.h>
to
#include</home/*******/common/glut.h>
(i.e. provided the entire path of the file glut.h which the program is trying to access)
(******* is just my username I am hiding)
When I again try to compile the file like this -
nvcc -lglut julia_cpu.cu
I get the following error -
In file included from ../common/gl_helper.h:44,
from ../common/cpu_bitmap.h:20,
from julia_gpu.cu:18:
/home/*******/Cuda By Example/cuda_by_example [source code]/common/GL/glut.h:151:1: warning: "APIENTRY" redefined
In file included from /home/*******/Cuda By Example/cuda_by_example [source code]/common/GL/glut.h:137,
from ../common/gl_helper.h:44,
from ../common/cpu_bitmap.h:20,
from julia_gpu.cu:18:
/usr/include/GL/gl.h:104:1: warning: this is the location of the previous definition
/home/*******/Cuda By Example/cuda_by_example [source code]/common/GL/glut.h(158): warning: omission of exception specification is incompatible with previous function "exit"
/usr/include/stdlib.h(646): here
/home/*******/Cuda By Example/cuda_by_example [source code]/common/GL/glut.h(158): warning: omission of exception specification is incompatible with previous function "exit"
/usr/include/stdlib.h(646): here
/usr/bin/ld: cannot find -lglut
collect2: ld returned 1 exit status
I don`t understand what am I missing or where am I going wrong.
Any help will be greatly appreciated!