kdevelop + allegro
BackwardsDown

Hi,

I have been reading the site and the forums, but I still dont know how to compile allegro within kdevelop.

I have installed allegro, and example's from tutorials compile just fine (outside kdevelop with "$make".

Can someone write in short how to set kdevelop up? Or a link to a tutorial?

CGamesPlay
BackwardsDown
Quote:

niels@niels-desktop:~/Programmeer/C++/allegro2$ make
make all-recursive
make[1]: Entering directory `/home/niels/Programmeer/C++/allegro2'
Making all in src
make[2]: Entering directory `/home/niels/Programmeer/C++/allegro2/src'
if g++ -DHAVE_CONFIG_H -I. -I. -I.. @allegro_CFLAGS@ -g -O2 -MT allegro2.o -MD -MP -MF ".deps/allegro2.Tpo" -c -o allegro2.o allegro2.cpp; \
then mv -f ".deps/allegro2.Tpo" ".deps/allegro2.Po"; else rm -f ".deps/allegro2.Tpo"; exit 1; fi
g++: @allegro_CFLAGS@: No such file or directory
make[2]: *** [allegro2.o] Error 1
make[2]: Leaving directory `/home/niels/Programmeer/C++/allegro2/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/niels/Programmeer/C++/allegro2'
make: *** [all] Error 2
niels@niels-desktop:~/Programmeer/C++/allegro2$

I followed everyting, but with the command make it just goes completely worng:-/

HoHo

http://www.allegro.cc/forums/thread/513272

It used to work around a year ago, I'm not sure if it still does. IIRC iIt is based on the awiki article so it might not.

CGamesPlay

Can you post your src/Makefile.am, Makefile.am, and configure.in, please?

BackwardsDown

Project name: allegro2

Makefile.am:

Quote:

  1. not a GNU package. You can remove this line, if

  2. have all needed files, that a GNU package needs

AUTOMAKE_OPTIONS = foreign 1.4

SUBDIRS = src

configure.in:

Quote:

AC_INIT(configure.in)

AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(allegro2, 0.1)

AC_LANG_CPLUSPLUS
AC_PROG_CXX
AM_PROG_LIBTOOL

AC_OUTPUT(Makefile src/Makefile)

AM_PATH_ALLEGRO([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
AM_PATH_ALLEGRO()
AM_PATH_ALLEGRO(4.1.0)

src/Makefile.am

Quote:

bin_PROGRAMS = allegro2
allegro2_SOURCES = allegro2.cpp

  1. set the include path found by configure

INCLUDES= $(all_includes)

  1. the library search path.

allegro2_LDFLAGS = $(all_libraries)

allegro2_LDADD = $(allegro_LIBS)
AM_CFLAGS = $(allegro_CFLAGS)
AM_CXXFLAGS = $(allegro_CFLAGS)

Quote:

AM_PATH_ALLEGRO([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
AM_PATH_ALLEGRO()
AM_PATH_ALLEGRO(4.1.0)
AC_OUTPUT(Makefile src/Makefile)

They had to be the other way around, now it seems to compile just fine ;D

Thanks for that tread you gave me, because there was someone with the same problem.

CGamesPlay

Please remove these lines:

Quote:

AM_PATH_ALLEGRO([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
AM_PATH_ALLEGRO()

They were just an example :)

At your option, you can leave AM_PATH_ALLEGRO() and instead remove AM_PATH_ALLEGRO(4.1.0).

BackwardsDown
Quote:

They were just an example

Haha, I found it weird anyway::)

Now I have changed the code, but it doest compile, make doesnt do anything anymore, just:
make[2]: Nothing to be done for `all'.

my bad, made a few stupid mistakes, it works:P

CGamesPlay

That means it's already done. It only rebuilds it if you have changed the files :)

BackwardsDown

Yes, I was changing the wrong files:-/

Now it compiles fine, but when I run my program from the command line, it fails at this line:

Quote:

blit(my_pic, screen, 0,0,0,0,480,360); //Draw the whole bitmap to the screen at (0,0)

Quote:

niels@niels-desktop:~/Programmeer/C++/allegro2$ ./src/allegro2
Shutting down Allegro due to signal #11
Segmentation fault

I load my blit like this:

Quote:

my_pic = load_bitmap("picture.bmp", NULL); // Load our picture

The strange thing is, that when I run my program in kdevelop with build->execute program or debug->start the program just works!

HoHo

Problem is the programs have their working path's wront. Print out argv[0] from the main function and you'll see it is different.

One obvious solution would be to execute your program from the same directory as KDevelop.

CGamesPlay

Yeah, you need to do this:
niels@niels-desktop:~/Programmeer/C++/allegro2$ src/allegro2

BackwardsDown

niels@niels-desktop:~/Programmeer/C++/allegro2/src$ allegro2

Worked,

But wont other people have trouble with running my future games, because they are not running it from home/niels/Programmeer/C++/allegro2/src ?

CGamesPlay

Yes. The picture file needs to be in the same directory as the person running the program. In many cases, this is the same directory as the program. In others, this isn't, and you need to check in some other directory, for instance usr/share/games/allegro2.

BackwardsDown

Yay, you're great;D

Thread #588758. Printed from Allegro.cc