1. 首先,编译环境说明:
Centos5.6 X86_64 (64位)
gcc 4.1.2
cuda 4.0
2. 进入路径,编译
[jliu@localhost chapter04]$ cd /media/disk/cuda_me/CUDA by example/chapter04
[jliu@localhost chapter04]$ nvcc julia_gpu.cu
在包含自 ../common/cpu_bitmap.h:20 的文件中,
从 julia_gpu.cu:18:
../common/gl_helper.h:44:21: 错误:GL/glut.h:没有那个文件或目录
[jliu@localhost chapter04]$
3. 查看../common/gl_helper.h:44
glut.h和glext.h在../common目录下,但glx.h是在标准库/usr/include/GL下(可用locate命令查找一下),可见头文件中的GL不是同一个。所以,将#include <GL/glut.h>和#include <GL/glext.h>更改为#include “GL/glut.h”和#include “GL/glext.h”即可。
4. 再次编译
&n

本文记录了在Centos5.6环境下,使用CUDA 4.0编译《CUDA by example》中Julia Set分形代码遇到的问题及解决方案。主要问题包括:GL/glut.h头文件找不到、__device__限定符的使用、以及解决undefined reference到glut库的错误。通过修改头文件引用、添加__device__限定符、安装glut库、创建软链接,最终成功编译并运行程序。
最低0.47元/天 解锁文章
648

被折叠的 条评论
为什么被折叠?



