Sastraxi
Jan 30th, 2005, 06:17 PM
This tutorial is all about setting up certain GPL'd programs and libraries, so you can spend less time configuring things and more time working on your applications. The tutorial is split up into sections, with each section being broken down into ten or less steps. The tutorial is cumulative; you can stop at the end of any section, if you feel that the functionality you need has been accomplished.
Please Note!
This is incomplete.
1: Bloodshed Dev-C++ / MingW in one package
Bloodshed's Dev-C++ (http://www.bloodshed.net/devcpp.html) is a general purpose C++ graphical frontend under Win32 for the compiler of your choice. Here, we'll cover setting it up along with the port of the GNU Compiler Collection for Windows, MingW-32.
1. Get Bloodshed Dev-C++ 5.0 Beta with MingW 3.3.1 (http://prdownloads.sourceforge.net/dev-cpp/devcpp4991setup.exe).
2. Install Bloodshed Dev-C++ 5.0 Beta, with all options (you never know when you'll need them). Also, for the maximum compatibility with this tutorial, keep the default installation directory of c:\dev-cpp\.
3. When launching Dev-C++ for the first time, a wizard will walk you through the post-installation process. The first step is up to you; the second however is about automatic code completion, a very nice feature which I recommend you turn on, and keep the cache in the default directory.
4. Take some time to familiarise yourself with Dev-C++'s IDE. At least look through the number of different application projects that can be made. Notice the third tab - OpenGL applications! Great!
5. Once you can compile the code sample, proceed.
#include <iostream>
#include <cstdlib>
using namespace std;
int main(int argc, char** argv) {
cout << "Dev-C++ is installed and configured." << endl;
system("PAUSE");
return 0;
}
2: Extending Dev-C++
Dev-C++ 5 Beta's new package manager makes installing new packages for the system a breeze. Follow these simple steps.
1. In Dev-C++, open the Tools menu and choose Check for Updates.
2. Retrieve the package list from the selected server.
3. Select all the packages you want. It is a good idea to get the Help and Tips files for your language, as well as all the libraries (or at least SDL, OpenGL, freeglut, and DirectX 9).
4. Select Download Selected to upgrade Dev-C++ with these new packages.
5. Now, your Dev-C++ installation is nicely broken. Let's fix that by going to the Tools menu again and choosing Compiler Options. Switch over to the Directories tab.
6. Change C:\Dev-Cpp\lib\gcc-lib\mingw32\3.3.1 to C:\Dev-Cpp\lib\gcc\mingw32\3.4.2.
7. Switch over to C++ includes and replace every directory that includes "3.3.1" with the respective directory that contains "3.4.2". Take note that, as in Step 6, "gcc-lib" will have to be changed to "gcc".
8. Recompile the program from Section 1 to continue.
3: OpenGL/GLEW
OpenGL is a graphical framework (the Open Graphics Library) that is based on a series of extensions and as a plus it is - for the most part - Free Software. A plus about the MingW distribution is that it comes with the OpenGL header files gl.h, glu.h, and glext.h, which means you don't need to get these base headers to make your OpenGL applications/games. However, there are a few helper libraries that will smooth the learning curve. A useful library is GLEW (http://glew.sourceforge.net/), and while I won't get into specifics here, it helps a lot. Also available is freeglut, which we downloaded in the last section. Note that freeglut is compatible with GLUT, but any program that uses glut will have to replace glut.h with freeglut.h.
2. Get GLEW 1.3.0 for Win32 (http://prdownloads.sourceforge.net/glew/glew-1.3.0-win32.zip?download).
3. Install GLEW by extracting everything in glew/ to your Dev-C++ directory (c:\dev-cpp by default).
4. Copy glew/lib/glew32.dll to %SystemRoot%.
5. Start a new freeglut project (Multimedia), and add -lglew32 to the Project's linker parameters. Compile the following code to continue.
#include <GL/glew.h>
#include <GL/freeglut.h>
#include <cstdio>
int main(int argc, char **argv) {
glutInit(&argc, argv);
glutInitWindowSize(640,480);
glutInitWindowPosition(10,10);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("Blah");
GLenum err = glewInit();
if (err == GLEW_OK) {
glutMainLoop();
}
// if GLEW is found, the program will show a "dirty" window.
// if not, the window will only be shown only for a split second.
return 0;
}
Please Note!
This is incomplete.
1: Bloodshed Dev-C++ / MingW in one package
Bloodshed's Dev-C++ (http://www.bloodshed.net/devcpp.html) is a general purpose C++ graphical frontend under Win32 for the compiler of your choice. Here, we'll cover setting it up along with the port of the GNU Compiler Collection for Windows, MingW-32.
1. Get Bloodshed Dev-C++ 5.0 Beta with MingW 3.3.1 (http://prdownloads.sourceforge.net/dev-cpp/devcpp4991setup.exe).
2. Install Bloodshed Dev-C++ 5.0 Beta, with all options (you never know when you'll need them). Also, for the maximum compatibility with this tutorial, keep the default installation directory of c:\dev-cpp\.
3. When launching Dev-C++ for the first time, a wizard will walk you through the post-installation process. The first step is up to you; the second however is about automatic code completion, a very nice feature which I recommend you turn on, and keep the cache in the default directory.
4. Take some time to familiarise yourself with Dev-C++'s IDE. At least look through the number of different application projects that can be made. Notice the third tab - OpenGL applications! Great!
5. Once you can compile the code sample, proceed.
#include <iostream>
#include <cstdlib>
using namespace std;
int main(int argc, char** argv) {
cout << "Dev-C++ is installed and configured." << endl;
system("PAUSE");
return 0;
}
2: Extending Dev-C++
Dev-C++ 5 Beta's new package manager makes installing new packages for the system a breeze. Follow these simple steps.
1. In Dev-C++, open the Tools menu and choose Check for Updates.
2. Retrieve the package list from the selected server.
3. Select all the packages you want. It is a good idea to get the Help and Tips files for your language, as well as all the libraries (or at least SDL, OpenGL, freeglut, and DirectX 9).
4. Select Download Selected to upgrade Dev-C++ with these new packages.
5. Now, your Dev-C++ installation is nicely broken. Let's fix that by going to the Tools menu again and choosing Compiler Options. Switch over to the Directories tab.
6. Change C:\Dev-Cpp\lib\gcc-lib\mingw32\3.3.1 to C:\Dev-Cpp\lib\gcc\mingw32\3.4.2.
7. Switch over to C++ includes and replace every directory that includes "3.3.1" with the respective directory that contains "3.4.2". Take note that, as in Step 6, "gcc-lib" will have to be changed to "gcc".
8. Recompile the program from Section 1 to continue.
3: OpenGL/GLEW
OpenGL is a graphical framework (the Open Graphics Library) that is based on a series of extensions and as a plus it is - for the most part - Free Software. A plus about the MingW distribution is that it comes with the OpenGL header files gl.h, glu.h, and glext.h, which means you don't need to get these base headers to make your OpenGL applications/games. However, there are a few helper libraries that will smooth the learning curve. A useful library is GLEW (http://glew.sourceforge.net/), and while I won't get into specifics here, it helps a lot. Also available is freeglut, which we downloaded in the last section. Note that freeglut is compatible with GLUT, but any program that uses glut will have to replace glut.h with freeglut.h.
2. Get GLEW 1.3.0 for Win32 (http://prdownloads.sourceforge.net/glew/glew-1.3.0-win32.zip?download).
3. Install GLEW by extracting everything in glew/ to your Dev-C++ directory (c:\dev-cpp by default).
4. Copy glew/lib/glew32.dll to %SystemRoot%.
5. Start a new freeglut project (Multimedia), and add -lglew32 to the Project's linker parameters. Compile the following code to continue.
#include <GL/glew.h>
#include <GL/freeglut.h>
#include <cstdio>
int main(int argc, char **argv) {
glutInit(&argc, argv);
glutInitWindowSize(640,480);
glutInitWindowPosition(10,10);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("Blah");
GLenum err = glewInit();
if (err == GLEW_OK) {
glutMainLoop();
}
// if GLEW is found, the program will show a "dirty" window.
// if not, the window will only be shown only for a split second.
return 0;
}