Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » kdevelop + allegro

Credits go to HoHo for helping out!
This thread is locked; no one can reply to it. rss feed Print
kdevelop + allegro
BackwardsDown
Member #8,018
November 2006

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
Member #2,559
July 2002
avatar

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

BackwardsDown
Member #8,018
November 2006

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
Member #4,534
April 2004
avatar

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.

__________
In theory, there is no difference between theory and practice. But, in practice, there is - Jan L.A. van de Snepscheut
MMORPG's...Many Men Online Role Playing Girls - Radagar
"Is Java REALLY slower? Does STL really bloat your exes? Find out with your friendly host, HoHo, and his benchmarking machine!" - Jakub Wasilewski

CGamesPlay
Member #2,559
July 2002
avatar

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

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

BackwardsDown
Member #8,018
November 2006

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
Member #2,559
July 2002
avatar

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).

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

BackwardsDown
Member #8,018
November 2006

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
Member #2,559
July 2002
avatar

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

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

BackwardsDown
Member #8,018
November 2006

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
Member #4,534
April 2004
avatar

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.

__________
In theory, there is no difference between theory and practice. But, in practice, there is - Jan L.A. van de Snepscheut
MMORPG's...Many Men Online Role Playing Girls - Radagar
"Is Java REALLY slower? Does STL really bloat your exes? Find out with your friendly host, HoHo, and his benchmarking machine!" - Jakub Wasilewski

CGamesPlay
Member #2,559
July 2002
avatar

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

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

BackwardsDown
Member #8,018
November 2006

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
Member #2,559
July 2002
avatar

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.

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

BackwardsDown
Member #8,018
November 2006

Yay, you're great;D

Go to: