Learning OpenGL

本文记录了作者初次接触并尝试设置OpenGL编程环境的过程。在安装并配置DevC++与OpenGL的过程中遇到了链接错误,通过调整文件放置位置及使用管理员权限启动等方式成功解决问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

But for those of us what lived and died in them furious days

it was like everything we knew was mightily swept away

And no matter what they did to build the city up again

for the rest of time

it would be like no one even knew we was ever here.

                                          ----From a film

For long time exploring,I decide to start learning OpenGL.

During the time I will take notes the problems and the answers.

Today after downloading the Dev C++(Or CodeBlocks) and OpenGL,we need to set up the

environment for the programming.The OpenGL package I download is glutming.First we copy

the glut.h to ~/include/GL,copy glut32.dll to $WindowsDir$/system32,copy the glut32.lib to ~/lib.

Then I write a simple progrm to test the setting.The program can be compiled correctly but it

reports linkage error.By searching,I find a answer like this:

"I search this problem in google, and find this website:

http://www.iscs.nus.edu.sg/~liusheny/DevCppOpenGL.html

It is nearly the complete answer to me except the following linkage error:

[Linker error] undefined reference to '__glutInitWithExit@12'
[Linker error] undefined reference to '__glutCreateWindowWithExit@8'
[Linker error] undefined reference to '__glutCreateMenuWithExit@8'

Again I ask for help in the internet, and find the following answer:

try putting this in your source code, before the includes
#define GLUT_DISABLE_ATEXIT_HACK

To this moment, the linker error disappear, and we can run the program successfully.

Congratulations!"------http://fsli.blog.hexun.com/18279240_d.html


but I don't use it.I do three steps:

1) Not only we should copy the glut32.lib to ~/lib,we need  the file "libglut32.a" go to there too.

2) Because I use win7 OS,it concerns the authority,we need start the Dev c++ using the admin right.

3) Before running the program,we need to add link "libopengl32.a libglu32.a libglut32.a" by the order to link libraries


  the last I think it is better to using the four files --glut.h,glut32.dll,glut32.lib,libglut32.a in one version.

  This seting is used in Windows7/Vista OS.

转载于:https://www.cnblogs.com/liveshow/archive/2011/06/19/2084883.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值