Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Allegro5 Works with codeblocks but crashes with qtcreator

This thread is locked; no one can reply to it. rss feed Print
Allegro5 Works with codeblocks but crashes with qtcreator
PTSeeker
Member #16,717
July 2017

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
Second in Command
February 2005
avatar

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

“Throughout history, poverty is the normal condition of man. Advances which permit this norm to be exceeded — here and there, now and then — are the work of an extremely small minority, frequently despised, often condemned, and almost always opposed by all right-thinking people. Whenever this tiny minority is kept from creating, or (as sometimes happens) is driven out of a society, the people then slip back into abject poverty. This is known as "bad luck.”

― Robert A. Heinlein

PTSeeker
Member #16,717
July 2017

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
Second in Command
February 2005
avatar

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.

“Throughout history, poverty is the normal condition of man. Advances which permit this norm to be exceeded — here and there, now and then — are the work of an extremely small minority, frequently despised, often condemned, and almost always opposed by all right-thinking people. Whenever this tiny minority is kept from creating, or (as sometimes happens) is driven out of a society, the people then slip back into abject poverty. This is known as "bad luck.”

― Robert A. Heinlein

Polybios
Member #12,293
October 2010

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

PTSeeker
Member #16,717
July 2017

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?

Neil Roy
Member #2,229
April 2002
avatar

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.

--
Deluxe Pacman (website now gone)
"I am not ashamed of my belief in God."

Ariesnl
Member #2,902
November 2002
avatar

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

- Wisdom is the art of using knowledge
- String theory: There's music in everything

Polybios
Member #12,293
October 2010

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.

Go to: