C_and_CPP 版 (精华区)
发信人: SwordLea (飞刀李), 信区: C_and_CPP
标 题: Re: dev cpp中如何使用glut.h?(转载)
发信站: 哈工大紫丁香 (2003年11月18日11:23:08 星期二), 站内信件
Step 1: Download Dev-C++ IDE from http://www.bloodshed.net/dev/devcpp.html. It
is better to download the Dev-C++ 5.0 beta 8 (4.9.8.0) (12 MB) with Mingw/GCC
3.2.
Step 2: Install it to the default path C:\Dev-Cpp (do not change the path,
otherwise your life will be harder)
Step 3: Uninstall and Configuration.
If Dev-C++ does not work well, go to its installation folder, run
uninstall.exe, and then delete its configuration files that are devcpp.cfg
and devcpp.ini under C:\Documents and Settings\your user name\Local
Settings\Application Data
Step 4: Glut.
Download the compatible glut for mingw from
http://mywebpage.netscape.com/PtrPck/glutming.zip, unzip it, copy the glut.h
and libglut32.a from its include/lib folder to appropriate Dev-C++ folder.
Its dll is compatible with the one used for Visual Studio.
Step 5: OpenGL setting
For any graphics porject (using gl, glu or glut), need to link the Opengl
libraries to it. Go to Menu Project, choose Project options, under Parameters
tag, set the OpenGL libraries/Objects: -lopengl32 -lglu32 -lglut32 (note the
libs order, make sure, opengl lib is linked before glu and glut)
Problem:
Dev-C++ does not support C style codes (It may support C style codes with
some setting, I do not know how). For example,
#include <iostream.h> need to be changed to
#include <iostream>
using namespace std;
And: #include <fstream.h> also need to be changed to
#include <fstream>
using namespace std;
Port 2003 372 Assignments
Ass1Q1: work without any modification
Ass1Q2: Add openGL libs to the projects: -lopengl32 -lglu32 -lglut32;
Compilation errors:size in array new must have integral type
Fixed by adding int type casting to numVertices in vertices=new
CVec2df[(int)numVertices]
Ass1Q3: Link the openGL libs to it.
Ass2: Modify the C style IO codes to C++ style, Link the openGL libs to it.
Ass3: Modify the C style IO codes to C++ style, Link the openGL libs to it.
Compilation errors:
CCamera.cpp definition of implicitly-declared `CCamera::~CCamera()' :
Fixed by move the destructor method to CCamera header file.
SincTerrain.cpp no matching function for call to `max(float, int)':
Fixed by casting int to float
Ass4-Raytracer: Modify the C style IO codes to C++ style, Link the openGL
libs to it
Compilation errors:
SceneDescription.cpp no matching function for call to `CRay::CRay(...)
CRay reflect(feeler.start,hitNormal.reflect(ray.dir)); // error code
Fixed by changing the codes to
CRay reflect;
reflect.start = feeler.start;
reflect.dir = hitNormal.reflect(ray.dir);
ColorModel: Modify the C style IO codes to C++ style, Link the openGL libs to
it
Compilation errors:
ColourModels.cpp no matching function for call to `min(int, float)'
Fixed by casting int to float
ColourModels.cpp no matching function for call to `max(int, const float&)'
Fixed by casting int to float
【
在 JZY ( 未出混沌) 的大作中提到: 】: 【 以下文字转载自 Unix
讨论区 】: 【 原文由 JZY 所发表 】 : 本来编译好的程序,增加一个glut.h就出错。
: 主要是我想使用glut.h这个工具库。
: 请问问题出在什么地方?谢谢!
--
※ 来源:·哈工大紫丁香 bbs.hit.edu.cn·[FROM: 202.118.246.231]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:5.969毫秒