Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » How-To install Allegro (with MinGW (and Netbeans)) También en Español

This thread is locked; no one can reply to it. rss feed Print
How-To install Allegro (with MinGW (and Netbeans)) También en Español
MikiLoz92
Member #12,615
March 2011

HOW-TO INSTALL ALLEGRO (WITH MINGW (AND NETBEANS))

(También en Español) By MikiLoz92

Tested in a 64 bit machine on Windows 7. Should also work on other versions and on 32 bit architectures. ;D

  • 1. For starters, you must install MinGW.

  • 2. Install MinGW in the default folder, which is C:\MinGW.

  • 3. Once everything is on place (if the setup missed some packages you might try reinstalling), copy the C:\MinGW\msys folder to C:\.

  • 4. Go to Control Panel->System->Advanced system configuration->Environment variables and add two variables: the first, path, must contain C:\MinGW\bin and C:\msys\1.0\bin; and the second, mingdir, must be C:\MinGW. It doesn't matter wether you add them on the user or the system panel. The last one is not necessary if you're not using a version of Windows above Vista.

  • 5. To check that the compiler is working, we might create a simple helloworld example en C++ and compile it from cmd this way: "g++ example.cpp -o example.exe" It is not required to be in the same directory as the compiler, as we have already set our path variable for that matter.

  • 6. Next, we download the FULL version of Netbeans, the one that is about 300MB. It is the only one to download because it is only one that supports MinGW as well.

  • 7. We download Java's JDK and install it while this thing downloads.

  • 8. Once Netbeans finishes downloading, we install it without missing any component.

  • 9. We execute it as it is installed y go straight forward to Tools->Plugins. Here, we activate the C/C++ plugin y restart the IDE.

  • 10. As soon as it has entered again, we go to Tools->Options->C/C++ and add a new Toolchain. We navigate to C:\MinGW\bin and accept. If everything's fine, it should detect a MinGW toolchain. We accept again.

  • 11. We can see the make program is missing. No worries, though, we have to set it manually, as it is in C:\msys\1.0\bin\make.exe.

  • 12. Now for the fun part: We must download any version of Allegro that is compiled to MinGW (I used 4.2.3) from allegro.cc.

  • 13. Now let's unzip the content of it in the MinGW folders, combining them between themselves and saying yes if asked to overwrite.

  • 14. Also, and I don't know if this is necessary or not (but I believe it is), you need to copy the alleg42.dll included in the bin folder to your System32 folder or to the folder where your Allegro compiled executable is. If it doesn't work after, try with the three dlls on the bin folder.

  • 15. Finally, we create the new project where all our code is gonna lie. Once it is created, right-click on it->Propierties->Build->Linker->Libraries and we add the option -lalleg.

  • 16. Now it should be all ready. The next thing to do is trying a simple example:

#SelectExpand
1#include <allegro.h> 2#include <iostream> 3using namespace std; 4 5int main() { 6 cout << "HOLA MUNDO!" << endl; 7 allegro_init(); 8 install_keyboard(); 9 set_gfx_mode(GFX_SAFE,320,200,0,0); 10 readkey(); 11 return 0; 12} 13END_OF_MAIN();

  • 17. If this example compiles and runs without a problem, good for you, you're done 8-) . Else: Check every single step or seek for help in one of the pages I went through to write this tutorial:

http://www.nachocabanes.com/videojuegos/ipj/ipj01j.php
http://alleg.sourceforge.net/latestdocs/en/build/mingw32.html
http://www.youtube.com/watch?v=IDRJ_xQVZUU
http://forums.netbeans.org/topic8393.html
http://netbeans.org/community/releases/68/cpp-setup-instructions.html
http://wiki.allegro.cc/index.php?title=MinGW
http://www.dreamincode.net/forums/topic/126823-using-allegro-with-netbeans-in-using-linux/

I also include the original spanish version of this tutorial as it is my native language:
Tambíen incluyo la versión en español de este tutorial:

Quote:

INSTALAR ALLEGRO (CON MINGW (Y NETBEANS)):

Probado en un equipo de 64 bits con Windows 7. Debería funcionar igualmente en 32 bits.

1. Para empezar, debes descargar MinGW.
2. Instala MinGW en el directorio de instalación predeterminado, que por defecto es C:\MinGW.
3. Una vez instalado TODO (si quedan paquetes, probar reinstalando), copiar la carpeta C:\MinGW\msys a C:, de manera que quede C:\msys\...
4. Vamos a Panel de Control->Sistema->Configuración avanzada del sistema (Cambiar configuración)->Variables de entorno y añadimos, ya sea en variables de usuario o del sistema, la variable path, a la que daremos valores de C:\MinGW\bin y C:\msys\1.0\bin, y la variable mingdir, que tomará C:\MinGW como valor. Esta última se puede omitir si no se está usando una versión de Windows superior a Vista.
5. Para comprobar que el compilador funciona, podemos crear un sencillo Hola Mundo en C++ y compilarlo desde cmd de esta manera: "g++ ejemplo.cpp -o ejemplo.exe". No nos hace falta estar en el mismo directorio que el ejecutable del compilar ya que por eso hemos añadido la ruta a los archivos binarios en path.
6. Seguidamente, descargamos la versión COMPLETA (la de 320 MB) de Netbeans 6.9.1; tenemos que descargar la completa ya que es la única que funciona con MinGw.
7. Descargamos el JDK de java y lo instalamos de mientras.
8. Si ya se ha bajado Netbeans, lo instalamos sin omitir ningún componente.
9. Lo abrimos en cuanto se haya instalado y vamos directos a Herramientas->Complementos. Aquí activamos el complemento de C/C++ y reiniciamos el IDE.
10. En seguida que ha entrado de nuevo, vamos a Herramientos->Opciones->C/C++ y añadimos una nueva "Colección de Herramientas". Navegamos hasta C:\MinGW\bin y aceptamos. Si todo va bien, debería autodetectarla como una colección de herramientas MinGW. Clicamos a Aceptar.
11. Nos fijamos en que nos falta el programa de make. No temáis, tenemos que ponerlo manualmente, y está en C:\msys\1.0\bin\make.exe.
12. Ahora nos vamos a centrar en Allegro, descargaremos cualquier versión de Allegro compilada para MinGW (yo utilizé la 4.2.3 en el momento de escribir este tutorial) de allegro.cc.
13. Descomprimimos el contenido del zip en las carpetas de MinGW, combinándolas con las ya existentes y dándole a Sí si nos pide reemplazar.
14. Por último, creamos un Nuevo Proyecto en el que guardaremos nuestro código de Allegro. Nada más crearlo hacemos clic derecho sobre él, Propiedades->Build->Linker y en Libraries añadimos la opción -lalleg.
15. Con todo esto ya debería estar listo. Lo siguiente es probarlo con un ejemplo fácil:

#include <allegro.h>
#include <iostream>
using namespace std;

int main() {
    cout << "HOLA MUNDO!" << endl;
    allegro_init();
    install_keyboard();
    set_gfx_mode(GFX_SAFE,320,200,0,0);
    readkey();
    return 0;
}
END_OF_MAIN();

16. Si este ejemplo compila y se ejecuta sin problemas, puedes dar por concluido el tutorial, sinó, revisa todos los pasos o busca ayuda en alguna de estas otras páginas en las que me basé para escribir este tutorial:

http://www.nachocabanes.com/videojuegos/ipj/ipj01j.php
http://alleg.sourceforge.net/latestdocs/en/build/mingw32.html
http://www.youtube.com/watch?v=IDRJ_xQVZUU
http://forums.netbeans.org/topic8393.html
http://netbeans.org/community/releases/68/cpp-setup-instructions.html
http://wiki.allegro.cc/index.php?title=MinGW
http://www.dreamincode.net/forums/topic/126823-using-allegro-with-netbeans-in-using-linux/

Go to: