Allegro5 Works with codeblocks but crashes with qtcreator
PTSeeker

I have decided to continue allegro development on linux and installed qtcreator on linux mint. Created new project and tried to run my code which I wrote in visual studio previously.

But it didn't worked. It builds successfully but when i try to run it crashes on al_draw_bitmap.

I have checked that and it seems that the png file doesn't loading and variable remains as null.

But on codeblocks everything works fine. How can I solve this guys I am trying to solve that since yesterday :(

added all the libs to .pro file and include path

Arthur Kalliokoski

On Linux, filenames are case sensitive, and directory separators are forward slashes, i.e. what would work on Windows

"\\data\\myfile.png"

vs.

"/data/MyFile.png"

Either of the above would work for windows, but the first would never work on linux and the second would only work if the file was named "/data/MyFile.png" but not "/data/MYFILE.PNG" or whatever

PTSeeker

I have done that as it should too.

I am using forward slashes but that png file I am talking about is in same folder with source file and has fully lower case name.

so I have used al_load_bitmap("sheet.png");

same code is working on codeblocks but fails on qtcreator

Arthur Kalliokoski

I don't use IDE's at all, but some of them use a different working directory than others.

Try using al_change_directory(), passing the same directory path as your .png file (before you try loading the png, of course) and see if it works then. It's probably a good idea to do that anyway, as different user shells might have different working directories too.

Polybios

It's probably this: Select "Projects" from the left (CTRL+5 should do it), select configuration for "run", not "build", change working directory.

PTSeeker

Thanks a lot you two. You just saved me changing working directory solved the problem but probably changing allegro directory is better way to do that

I also prefer not using IDEs as told us in school but working with allegro without ide is just seems too hard is there any good way to do that?

NiteHackr

If you want to try programming without an IDE, you just need to learn how to create a "makefile". You then code using a text editor of your choice, save your changes, then you run "make" in the same folder as your code and your "makefile" and it would then compile everything up for you.

They're not too difficult to understand, I'm sure there's a tutorial out there somewhere.

Personally, I would stick to an IDE, preferably one that is commonly used by a lot of people. Code::Blocks is a really good choice as it is popular and maintained. It is available for Windows, Linux etc... so moving to another operating system is easy. Just try and code so your code is not platform specific.

Ariesnl

If you're not going to use a GUI or you're going to code your own, there's no need for QT. Code::Blocks will do
( and highly reccommended !)

Polybios

You can do non-Qt development very nicely with QtCreator, but you have to use CMake then. I like it better than CodeBlocks, but that's of course highly subjective.

Thread #616989. Printed from Allegro.cc