|
Compiling allegro programs, under linux terminal |
Phoxis
Member #10,005
July 2008
|
I have read the readme, and instructions, and have successfully compiled some allegro programs. But will someone kindly, re describe how to do a command line compilation of a program written with allegro functions, using gcc? |
Cody Harris
Member #4,406
March 2004
|
try on linking instead of -lalleg, using adding `allegro-config --libs` (use the proper quotes, the one that's on the same key as ~. Check out allegro-config for other options (such as cflags, cppflags, and libs) --------------------------------- |
bamccaig
Member #7,536
July 2006
|
IIRC, there is a command that "registers" libraries so that the linker can find them (according to the man page it seems like libraries are cached, likely for speed, and in order to find them the linker requires you to cache them). Until you do this the linker won't find the libraries you have installed since it was last executed. Something like ldconfig or something... ldconfig I haven't been using Linux enough recently to be sure, but that sounds right. Always check the man page before executing a command, however. There appears to be a configuration file for ld (the linker) called /etc/ld.so.conf so you might want to check that out as well (to make sure the Allegro libraries are in one of the specified directories). As Cody Harris said, there is a script in the Linux installation of Allegro that automatically outputs library options. It is called allegro-config. Therefore, you can use either back-tick syntax (`command`) or dollar-sign parenthesis syntax ($(command)) (depending on which shell you're using) to automatically insert the correct library options onto your command-line. gcc options `allegro-config --libs` source_files IIRC, $(command) is the new "right" way, but `command` is compatible with more/older shells. -- acc.js | al4anim - Allegro 4 Animation library | Allegro 5 VS/NuGet Guide | Allegro.cc Mockup | Allegro.cc <code> Tag | Allegro 4 Timer Example (w/ Semaphores) | Allegro 5 "Winpkg" (MSVC readme) | Bambot | Blog | C++ STL Container Flowchart | Castopulence Software | Check Return Values | Derail? | Is This A Discussion? Flow Chart | Filesystem Hierarchy Standard | Clean Code Talks - Global State and Singletons | How To Use Header Files | GNU/Linux (Debian, Fedora, Gentoo) | rot (rot13, rot47, rotN) | Streaming |
MilesPrower
Member #9,986
July 2008
|
I always use assuming that your main source file is named main.c can't help you with fedora, though. sorry. |
Trezker
Member #1,739
December 2001
|
I use a Speedhack makefile, with a few modifications for profiling and debugging. |
Thomas Fjellstrom
Member #476
June 2000
|
this is the (imo) proper set of commands: debug: gcc -W -Wall -ggdb3 -c file.c gcc file.o -o program `allegro-config --libs` release: gcc -W -Wall -c file.c gcc -s file.o -o program `allegro-config --libs` then run with ./program. -- |
nutter
Member #1,101
March 2001
|
Not sure if it adds much but if you want to link against allegro's debug library use: gcc -W -Wall -ggdb3 -c file.c gcc file.o -o program `allegro-config --libs debug`
|
Phoxis
Member #10,005
July 2008
|
Thanks for the replies. They would help me very much |
|