PDA

View Full Version : [SOLVED] Qt Creator and Allegro on Ubuntu 8.04

heatblazer
November 25th, 2010, 06:10 PM
Please help! I am trying to use allegro on qt creator 2.0 on ubuntu 8.04. Ive installed it but here is what always happens :(
A detailed explanation will be appriciated. Its my first step so please be concrete.

spjackson
November 25th, 2010, 08:11 PM
As with most libraries, it isn't enough simply to include the allegro header - you need to link to the allegro library too.

heatblazer
November 25th, 2010, 08:17 PM
As with most libraries, it isn't enough simply to include the allegro header - you need to link to the allegro library too.

And thats what I need to know how to do...

Tcressy
November 25th, 2010, 08:29 PM
Perhaps what your looking for is something like

gcc myfile.c -lallegro

probably something along those lines...You just need to link the library when you compile it. you might have to do the path to allegro after -l ?

spjackson
November 25th, 2010, 08:49 PM
And thats what I need to know how to do...
As you are using QtCreator, you need to add a line to your project's .pro file. Something like:

LIBS += -L/path/to/lib/directory -lallegro
but the details depend on where you installed the allegro library.

heatblazer
November 26th, 2010, 01:30 PM
As you are using QtCreator, you need to add a line to your project's .pro file. Something like:

LIBS += -L/path/to/lib/directory -lallegro
but the details depend on where you installed the allegro library.

That helped a lot. Now apps are starting. But after the black screen my desktop resolution is set to 640x480...any info?

heatblazer
November 26th, 2010, 03:16 PM
Thank you for assisting. I am moving on now... even loaded a itmap :)

spaceintruder
January 18th, 2012, 04:12 PM
As you are using QtCreator, you need to add a line to your project's .pro file. Something like:

LIBS += -L/path/to/lib/directory -lallegro
but the details depend on where you installed the allegro library.

Hello, i have tried Qt Creator with allegro on Ubuntu, and it works, according to your instruction ( manually editing .pro file ) but same approach doesn't work on Windows XP.
I know it's Ubuntu forum, but as those two products are platform independent (Qt and allegro itself) maybe someone here have a hint how to do it on Windows ( Qt Creator and allegro,latest releases ).
First of all, QtCreator doesn't recognize the header allegro.h, even when i add it to the project, and when i apply the above approach with LIB += includes to the pro file, it won't compile with message No rule to make target 

Zugzwang
January 18th, 2012, 06:04 PM
Hello, i have tried Qt Creator with allegro on Ubuntu, and it works, according to your instruction ( manually editing .pro file ) but same approach doesn't work on Windows XP.
I know it's Ubuntu forum, but as those two products are platform independent (Qt and allegro itself) maybe someone here have a hint how to do it on Windows ( Qt Creator and allegro,latest releases ).
First of all, QtCreator doesn't recognize the header allegro.h, even when i add it to the project, and when i apply the above approach with LIB += includes to the pro file, it won't compile with message No rule to make target

You might have better started a new thread for this one, because it is common to do so here. Furthermore, having "Ubuntu 8.04" in the name of your post isn't advantageous.

What compiler are you using under windows?
"INCLUDEPATH += \path\to\include\directory" to your project file and fill in the correct directory.

The stuff you specify in the "LIBS" variable in a QMake project file is only used during linking, and your problem is during compiling.

spaceintruder
January 18th, 2012, 07:34 PM
You might have better started a new thread for this one, because it is common to do so here. Furthermore, having "Ubuntu 8.04" in the name of your post isn't advantageous.

What compiler are you using under windows?
"INCLUDEPATH += \path\to\include\directory" to your project file and fill in the correct directory.

The stuff you specify in the "LIBS" variable in a QMake project file is only used during linking, and your problem is during compiling.

First of all, apologies for my way of posting, it was motivated because of similar solution on Ubuntu, which works.
I have MinGW g++ compiler, i have tried all ways to add libraries and headers, including writting to pro file, and yes i have included path to include dir as well, but nothing works.
When i start to write code, #include <allegro.h> or #include "allegro.h" both ways were immediately recognized in editor with path setup according to directive

win32:INCLUDEPATH += C:/MinGW/include

(maybe i was under impression of similar ways of solving this under other IDE's so i copied headers from allegro dir into MinGW folder)

but when i type function allegro_init(); after allegro the editor blinks with ALLEGRO_H, and allegro_init() is not recognized nor compiled as function.
Other code, standard C++ headers all work fine and compiles without problem.
I am now thinking, maybe i have to download prebuilt package for allegro to match correct version of MinGW?

My Allegro library is 4.2.3 while MinGW g++ version used by QtSDK is 4.4.0, but that shouldn't be problem.

Here are other directives i have tried to enter manually because i choosed empty QtCreator project and tried to fill pro file myself, from scratch, but nothing helps.

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../MinGW/lib/gcc/mingw32/4.6.2/ -lalleg win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../MinGW/lib/gcc/mingw32/4.6.2/ -lalld win32:INCLUDEPATH += C:/MinGW/lib/gcc/mingw32/4.6.2 win32:INCLUDEPATH += C:/MinGW/include win32:HEADERS += allegro.h winalleg.h win32:SOURCES += primer3.cpp win32:CONFIG += qt DEPENDPATH += $$PWD/../../../../MinGW/lib/gcc/mingw32/4.6.2 win32:CONFIG(release, debug|release): PRE_TARGETDEPS +=$$PWD/../../../../MinGW/lib/gcc/mingw32/4.6.2/alleg.lib else:win32:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../../../MinGW/lib/gcc/mingw32/4.6.2/alld.lib else:unix:!macx:!symbian: PRE_TARGETDEPS +=$$PWD/../../../../MinGW/lib/gcc/mingw32/4.6.2/liballeg.a
Also, i have noticed that when i type #include <allegro.h> in the editor the popup appears with possible files that are 'allegro.h" but also /allegro which is subfolder i have copied together wiht include files....nothing helps.

I am too confused now, hopefully not for long.