Author Topic: Using Allegro with CodeBlocks  (Read 9697 times)

Offline mattireland

  • Single posting newcomer
  • *
  • Posts: 7
Using Allegro with CodeBlocks
« on: May 08, 2008, 01:01:34 pm »
Hi,

I've just downloaded Code::Blocks after previously using Bloodshed Dev C++, because the former was recommended to me recently.

I was wondering if it was possible To use Allegro (http://www.talula.demon.co.uk/allegro/) with Code::Blocks and how to go about doing it because I have been unable to do this so far.

Thank you very much,

Matt. Ireland

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Using Allegro with CodeBlocks
« Reply #1 on: May 08, 2008, 01:13:49 pm »
Hello,

what did you do?

If you do not want to compile the sources by yourself, did you try to download the binary version for mingw e.g., allegro-mingw-4.2.2.zip? Did it not work? 

Best wishes,
Michael

Offline mattireland

  • Single posting newcomer
  • *
  • Posts: 7
Re: Using Allegro with CodeBlocks
« Reply #2 on: May 08, 2008, 02:10:08 pm »
Thanks very much for the prompt and helpful reply.

I downloaded the DevPack which I was previously using with DevC++ and then clicked onto Tools --> DevPacks and configured it appropriately - I hope (the directory being C:\DevCpp\Packages). The Allegro DevPack didn't show up though. I assume that I am doing something seriously wrong but not sure what?

Thanks again,

Matt. I

EDIT: UPDATE
I now have Allegro installed - that was me being noobish and not realising that you had to right-click the package and click download and install but with the following code:
Code: [Select]
#include <allegro.h>


int main(){

    allegro_init();
    install_keyboard();
    set_gfx_mode( GFX_AUTODETECT, 640, 480, 0, 0);

    readkey();

    return 0;

}
END_OF_MAIN();
The compiler returns an error on practically every line. I'm not sure what I'm doing wrong. It's not coding because this is virtually the same as the Allegro tutorial that I'm following so I assume it has to be something that I'm doing wrong with the compiler. Thanks!
« Last Edit: May 08, 2008, 02:18:00 pm by mattireland »

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Using Allegro with CodeBlocks
« Reply #3 on: May 08, 2008, 02:32:17 pm »
Hello,

what I will do is to give a try to a binary mingw release instead of use the devpack.

May be something goes wrong or some #include and lib are missing.

I will give it a try this evening to see if I will get the same problems.

Best wishes,
Michael

Offline PsYhLo

  • Almost regular
  • **
  • Posts: 157
Re: Using Allegro with CodeBlocks
« Reply #4 on: May 08, 2008, 03:23:31 pm »
what are the errors paste them here

Offline mattireland

  • Single posting newcomer
  • *
  • Posts: 7
Re: Using Allegro with CodeBlocks
« Reply #5 on: May 08, 2008, 03:57:16 pm »
@Michael: Thanks very, very much! That's really nice of you.
EDIT: Just gave it a go. It didn't work for me but I should be very grateful if you did have a go just in case I am missing something. Thanks.

@PsYhLo:
obj\Debug\main.o(.text+0x27)||In function `Z13_mangled_mainv':|
C:\Documents and Settings\Matt Ireland\My Documents\Programming\CBCPP\Allegro\AllegroTest1\AllegroTest1\main.cpp|6|undefined reference to `_install_allegro_version_check'|
obj\Debug\main.o(.text+0x2c):C:\Documents and Settings\Matt Ireland\My Documents\Programming\CBCPP\Allegro\AllegroTest1\AllegroTest1\main.cpp|7|undefined reference to `install_keyboard'|
obj\Debug\main.o(.text+0x58):C:\Documents and Settings\Matt Ireland\My Documents\Programming\CBCPP\Allegro\AllegroTest1\AllegroTest1\main.cpp|8|undefined reference to `set_gfx_mode'|
obj\Debug\main.o(.text+0x5d):C:\Documents and Settings\Matt Ireland\My Documents\Programming\CBCPP\Allegro\AllegroTest1\AllegroTest1\main.cpp|10|undefined reference to `readkey'|
obj\Debug\main.o(.text+0x92)||In function `WinMain':|
C:\Documents and Settings\Matt Ireland\My Documents\Programming\CBCPP\Allegro\AllegroTest1\AllegroTest1\main.cpp|15|undefined reference to `_WinMain'|
||=== Build finished: 5 errors, 0 warnings ===|
« Last Edit: May 08, 2008, 04:15:31 pm by mattireland »

Offline PsYhLo

  • Almost regular
  • **
  • Posts: 157
Re: Using Allegro with CodeBlocks
« Reply #6 on: May 08, 2008, 04:36:06 pm »
you have to linked against allegro.a file
at this moment i can't give you shot to see it how you can do it
but after some time (20 or more minutes) i'll ;)

Edit:
right button at projects name->Build options...->
and after that search the file ->

note i'm with linux but its the same ;)
« Last Edit: May 08, 2008, 05:00:43 pm by PsYhLo »

Offline mattireland

  • Single posting newcomer
  • *
  • Posts: 7
Re: Using Allegro with CodeBlocks
« Reply #7 on: May 08, 2008, 11:44:06 pm »
Hi,

Thanks very much for going to all that effort! I've done all that but get the following in the log:

Code: [Select]
-------------- Build: Debug in AllegroTest1 ---------------

Linking console executable: bin\Debug\AllegroTest1.exe
mingw32-g++.exe: e.t.c\allegro-mingw-4.2.2\allegro-mingw-4.2.2 -LC:\Dev-Cpp\Packages\lib  -o bin\Debug\AllegroTest1.exe obj\Debug\main.o    C:\Documents: Invalid argument
mingw32-g++.exe: and: No such file or directory
mingw32-g++.exe: Settings\Matt: No such file or directory
mingw32-g++.exe: Ireland\My: No such file or directory
mingw32-g++.exe: Documents\Programming\C++\Libraries: No such file or directory
mingw32-g++.exe: e.t.c\allegro-mingw-4.2.2\allegro-mingw-4.2.2\lib\libaldat.a C:\Documents: Invalid argument
mingw32-g++.exe: and: No such file or directory
mingw32-g++.exe: Settings\Matt: No such file or directory
mingw32-g++.exe: Ireland\My: No such file or directory
mingw32-g++.exe: Documents\Programming\C++\Libraries: No such file or directory
mingw32-g++.exe: e.t.c\allegro-mingw-4.2.2\allegro-mingw-4.2.2\lib\liballd.a C:\Documents: Invalid argument
mingw32-g++.exe: and: No such file or directory
mingw32-g++.exe: Settings\Matt: No such file or directory
mingw32-g++.exe: Ireland\My: No such file or directory
mingw32-g++.exe: Documents\Programming\C++\Libraries: No such file or directory
mingw32-g++.exe: e.t.c\allegro-mingw-4.2.2\allegro-mingw-4.2.2\lib\liballd_s.a C:\Documents: Invalid argument
mingw32-g++.exe: and: No such file or directory
mingw32-g++.exe: Settings\Matt: No such file or directory
mingw32-g++.exe: Ireland\My: No such file or directory
mingw32-g++.exe: Documents\Programming\C++\Libraries: No such file or directory
mingw32-g++.exe: e.t.c\allegro-mingw-4.2.2\allegro-mingw-4.2.2\lib\liballeg.a C:\Documents: Invalid argument
mingw32-g++.exe: and: No such file or directory
mingw32-g++.exe: Settings\Matt: No such file or directory
mingw32-g++.exe: Ireland\My: No such file or directory
mingw32-g++.exe: Documents\Programming\C++\Libraries: No such file or directory
mingw32-g++.exe: e.t.c\allegro-mingw-4.2.2\allegro-mingw-4.2.2\lib\liballeg_s.a C:\Documents: Invalid argument
mingw32-g++.exe: and: No such file or directory
mingw32-g++.exe: Settings\Matt: No such file or directory
mingw32-g++.exe: Ireland\My: No such file or directory
mingw32-g++.exe: Documents\Programming\C++\Libraries: No such file or directory
mingw32-g++.exe: e.t.c\allegro-mingw-4.2.2\allegro-mingw-4.2.2\lib\liballp.a C:\Documents: Invalid argument
mingw32-g++.exe: and: No such file or directory
mingw32-g++.exe: Settings\Matt: No such file or directory
mingw32-g++.exe: Ireland\My: No such file or directory
mingw32-g++.exe: Documents\Programming\C++\Libraries: No such file or directory
mingw32-g++.exe: e.t.c\allegro-mingw-4.2.2\allegro-mingw-4.2.2\lib\liballp_s.a: No such file or directory
mingw32-g++.exe: no input files
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings

It says 0 errors, 0 warnings so I don't understand why it won't run? There's nothing in the debug folder either.

Offline dje

  • Lives here!
  • ****
  • Posts: 683
Re: Using Allegro with CodeBlocks
« Reply #8 on: May 08, 2008, 11:58:54 pm »
Hi !

As the log tells you :
mingw32-g++.exe: e.t.c\allegro-mingw-4.2.2\allegro-mingw-4.2.2 -LC:\Dev-Cpp\Packages\lib  -o bin\Debug\AllegroTest1.exe obj\Debug\main.o    C:\Documents: Invalid argument
mingw32-g++.exe: and: No such file or directory
mingw32-g++.exe: Settings\Matt: No such file or directory


you've got a problem with spaces in your path.
Try to move your project dir to a dir without spaces in path.

Dje

Offline mattireland

  • Single posting newcomer
  • *
  • Posts: 7
Re: Using Allegro with CodeBlocks
« Reply #9 on: May 09, 2008, 12:36:01 pm »
Thanks very much! Moved them into C:\Allegro and it worked fine.

Thanks again very much everyone!

Matt. I

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Using Allegro with CodeBlocks
« Reply #10 on: May 12, 2008, 01:27:07 am »
Hello,

I have seen you have solved your problem already :D. I just wanted to post what I have done to make it works locally, but it is of no use now. I was too late :).

Btw, it was good to work again with CB :).

Good luck and best wishes
Michael 

Offline mattireland

  • Single posting newcomer
  • *
  • Posts: 7
Re: Using Allegro with CodeBlocks
« Reply #11 on: May 12, 2008, 02:08:39 pm »
Thanks very much for putting in the effort. If you do have anything useful, then it would be great if you could post it but if not thanks anyway.

Matt. I

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Using Allegro with CodeBlocks
« Reply #12 on: May 13, 2008, 10:52:14 am »
Hello,

may be one thing.

At the beginning I was getting a lot of link errors. Changing the libraries position did not helped out. So I gave a look at the instructions :) (very short to be honest :() and it was written to put the .dll into system32 folder, the libraries and the includes files into MinGW lib and include folders respectively.

To be honest, I would avoid to "throw" any dll into system32 folder, but store them into a separate folder and add its path the environmental variable system path. Also I would avoid to do what asked for MinGW include and lib. Better to keep the MinGW clean.

Anyway, I tried (before I did a MinGW backup) and re-tested. Nothing :(.

Then I tried to add only the libs with a '_s' in their names. Nothing :(.

So I tried to add only the libs without that '_s' and it worked :).

Anyway, it would be better to exactly (if possible) know what each lib is used for, to avoid to add useless things.

The project website seems to me a very nice place where to start to learn about allegro. I have found this French tutorial to be rather good (http://iteme.free.fr/download.php3?url=tutorials/Allegro.pdf&id=allegro).

All the best
Michael
« Last Edit: May 14, 2008, 09:40:08 am by Michael »