user1159789
user1159789

Reputation:

How to compile simple allegro file in Fedora?

I hope this isn't a repeat question. I installed Allegro 5 on my Fedora Linux distro. I installed cmake as well. My problem is that I want a simple example to compile, so that I can learn more of Allegro.

Here are some commands:

[alanxoc3@alanxocomputer ~]$ locate allegro
/etc/allegro5rc
/usr/lib/liballegro.so.5.0
/usr/lib/liballegro.so.5.0.3
/usr/lib/liballegro_color.so.5.0
/usr/lib/liballegro_color.so.5.0.3
/usr/lib/liballegro_font.so.5.0
/usr/lib/liballegro_font.so.5.0.3
/usr/lib/liballegro_main.so.5.0
/usr/lib/liballegro_main.so.5.0.3
/usr/lib/liballegro_memfile.so.5.0
/usr/lib/liballegro_memfile.so.5.0.3
/usr/lib/liballegro_primitives.so.5.0
/usr/lib/liballegro_primitives.so.5.0.3
/usr/share/doc/allegro5
/usr/share/doc/allegro5/CHANGES-5.0.txt
/usr/share/doc/allegro5/CONTRIBUTORS.txt
/usr/share/doc/allegro5/LICENSE.txt
/usr/share/doc/allegro5/README.txt

I have tried to use gcc to compile it, and I don't understand how I would use cmake, can't seem to find a good tutorial on that. My g++ command looks like this:

[alanxoc3@alanxocomputer t00]$ g++ main.cpp
main.cpp:5:30: fatal error: allegro5/allegro.h: No such file or directory
compilation terminated.

And here is my source file:

/**********************************************************
 * main.cpp - This program should create a test in the 
 * "Allegro" game programming language for c++.
 *********************************************************/
#include <allegro5/allegro.h>

int main (int argc, char *argv[])
{
   // Initialize a window
   allegro_init();
   install_keyboard();
   set_gfx_mode(GFX_AUTODETECT, 640, 480, 0 0);

   // Stall the program
   readkey();

   return 0;
}

END_OF_MAIN();

Thanks in advance, I would greatly appreciate some advice :).

Upvotes: 1

Views: 601

Answers (1)

Lightness Races in Orbit
Lightness Races in Orbit

Reputation: 385405

Whoops! You forgot to read the documentation.

By convention, a library's "main" packages only contain the redistributable binaries, such as those that you have listed in your question. There is usually also a "development" package, with suffix -devel, which includes headers needed to build programs that use the library.

Indeed, the relevant page on the Allegro wiki (first Google result for fedora allegro) lists allegro-devel as one of the available packages. Here's a quote from that page:

The -devel packages are required to compile programs that use Allegro 5. The -debuginfo package should contain the debug symbols for more useful output in case of a crash. The other packages are the runtimes for the core library and the addons (required to run Allegro 5 programs).

Upvotes: 1

Related Questions