Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Compiling CUDA program with OpenGL

  1. #1
    Newbie Newbie
    Join Date
    Oct 2017
    Posts
    2

    Compiling CUDA program with OpenGL

    Hi all,

    I am trying to compile a CUDA program which uses OpenGL APIs. When I compiled it using the following command:

    nvcc -O2 -arch=sm_50 -lGL -lGLX -o out julia_cpu.cu

    I got the following error messages:

    /usr/include/GL/glext.h(111): error: identifier "GLenum" is undefined

    /usr/include/GL/glext.h(111): error: identifier "GLuint" is undefined

    /usr/include/GL/glext.h(111): error: identifier "GLuint" is undefined

    /usr/include/GL/glext.h(111): error: identifier "GLsizei" is undefined

    /usr/include/GL/glext.h(111): error: identifier "GLenum" is undefined

    /usr/include/GL/glext.h(112): error: identifier "GLenum" is undefined

    /usr/include/GL/glext.h(112): error: identifier "GLint" is undefined

    /usr/include/GL/glext.h(112): error: identifier "GLint" is undefined

    /usr/include/GL/glext.h(112): error: identifier "GLsizei" is undefined

    /usr/include/GL/glext.h(112): error: identifier "GLsizei" is undefined

    /usr/include/GL/glext.h(112): error: identifier "GLsizei" is undefined

    /usr/include/GL/glext.h(112): error: identifier "GLint" is undefined

    /usr/include/GL/glext.h(112): error: identifier "GLenum" is undefined

    /usr/include/GL/glext.h(112): error: identifier "GLenum" is undefined

    /usr/include/GL/glext.h(113): error: identifier "GLenum" is undefined

    /usr/include/GL/glext.h(113): error: identifier "GLint" is undefined

    /usr/include/GL/glext.h(113): error: identifier "GLint" is undefined


    How can I remove these errors?

    Thanks,

    malik

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,170
    #include <GL/glext.h> requires that <GL/gl.h> be included first, as it defines the typedefs for the symbols that are undefined above.

    Alternatively, you could try including <cuda_gl_interop.h> first if you want. I think it pulls in <GL/gl.h> for you (but double-check that).

  3. #3
    Newbie Newbie
    Join Date
    Oct 2017
    Posts
    2
    Thanks. If I understand correct, I can use only <cuda_gl_interop.h> instead of other.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •