Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Failes to create display...

This thread is locked; no one can reply to it. rss feed Print
Failes to create display...
clzola
Member #12,499
January 2011

Hi... I'm new here. I'm trying to install Allegro 5 (I used A4, now, want to move A5)

Well, I dont know where is my fault. I downloaded Windows Binaries MinGW 3.4.5. I am using DevC++ and CodeBlocks 10.05.

First DevC++.
I put files from Allegro5 bin folder to DevC++/bin folder. Include files, put in DevC++/include folder. And lib files to DevC++/lib folder.
Started new C++ Project, go to the linker options and there I add this lib: liballegro-5.0.0-RC4-mt.a (I browsed for it). Then I make new main.cpp file, and paste this code:

#SelectExpand
1#include <stdio.h> 2#include <allegro5/allegro.h> 3 4int main(int argc, char **argv) 5{ 6 ALLEGRO_DISPLAY *display = NULL; 7 8 if(!al_init()) { 9 fprintf(stderr, "failed to initialize allegro!\n"); 10 return -1; 11 } 12 13 display = al_create_display(640, 480); 14 if(!display) { 15 fprintf(stderr, "failed to create display!\n"); 16 return -1; 17 } 18 19 al_clear_to_color(al_map_rgb(0,0,0)); 20 21 al_flip_display(); 22 23 al_rest(10.0); 24 25 al_destroy_display(display); 26 27 return 0; 28}

I pressed F9, and it compiled, but then, window pop-ups blinking for few seconds. Window was also transparent, and then it closed. In my console window it says this: "failed to create display!"

I also tried with MinGW 4.5.0 files, and linked "liballegro-5.0.0-RC4-md.a" but then I got error that I am missing a file: libgcc_s_dw2-1.dll (I think this is because of MinGW Version that came with DevC++)

Then I tried with Code::Blocks 10.05. Put all files in CodeBlocs/MinGW/bin, lib and include.
First linked 'mt' lib and got same result that I did with DevC++ and this lib.
When I tried 'md' lib, got msg that I am missing a file: libgcc_s_dw2-1.dll

I am running this under Windows XP Tiny 32bit in my VirtualBox. Host OS is Linux Ubutnu 10.10 32bit
Please HELP me....

torhu
Member #2,727
September 2002
avatar

Try doing al_set_new_display_flags(ALLEGRO_WINDOWED) before creating the display. Maybe your machine can't handle a 640x480 resolution? I'm not sure which options al_create_display tries, or what is the default, is there a fallback, etc.

EDIT: oh wait, you're running in VirtualBox. Then I'm not sure what will work and what will not. Maybe try using openGL instead of D3D?

clzola
Member #12,499
January 2011

Allegro 4 works fine int my VirtualBox in resolution 1024x768.
I'll try this with flag. Also i don't know anything about OpenGL. Never tried to learn :D

Edit: al_set_new_display_flags(ALLEGRO_WINDOWED); is not working.... :/

Edgar Reynaldo
Member #8,592
May 2007
avatar

clzola said:

Allegro 4 works fine int my VirtualBox in resolution 1024x768.
I'll try this with flag.

If your native resolution is 1024X768, then you may not be able to create a window that size, unless you use ALLEGRO_NOFRAME. Allegro 4 couldn't set a windowed size larger than the desktop, and Allegro 5 may not be able to either.

clzola said:

Also i don't know anything about OpenGL. Never tried to learn

You don't need to know anything about OpenGL to use Allegro 5, it uses OpenGL for you.

clzola said:

al_set_new_display_flags(ALLEGRO_WINDOWED); is not working.... :/

What resolution are you trying it at?

Read over al_set_new_display_flags.

clzola
Member #12,499
January 2011

In VirtualBox, Windows XP resolution is 1152x864.
For Allegro 5, I am trying 640x480 (see code)... Also tried 320x240

Edgar Reynaldo
Member #8,592
May 2007
avatar

So, just to confirm, this code is not working for you?

#SelectExpand
1//... 2al_set_new_display_flags(ALLEGRO_WINDOWED); 3display = create_display(640,480);

What about this (as Torhu suggested) :

#SelectExpand
1//... 2al_set_new_display_flags(ALLEGRO_OPENGL | ALLEGRO_WINDOWED); 3display = create_display(640,480);

If neither works, post the log file that allegro creates. I'm not sure what it is called with Allegro 5 though.

clzola
Member #12,499
January 2011

Both codes don't work for me.
Well, maybe is something with drivers, because when I installed Windows XP Tiny version in my VirtualBox, I did not install any drivers. (Going to try this tomorrow)
I don't know where is that log file???

I tried this Allegro 5 code on Linux Ubuntu 10.10 (Host OS) using Code::Blocks 10.05 and it works. So I guess, the problem is with Windows XP.... (Tiny version, it could be that :/)

Edgar Reynaldo
Member #8,592
May 2007
avatar

clzola said:

I did not install any drivers. (Going to try this tomorrow)

Hopefully, updating your graphics drivers should help.

Did you try using (ALLEGRO_DIRECT3D | ALLEGRO_WINDOWED)?

clzola said:

I don't know where is that log file???

It should be in the same folder as your program. You may need to compile and link in debug mode to get it though. I don't know.

Evert
Member #794
November 2000
avatar

You may need to compile and link in debug mode to get it though. I don't know.

You need to link with the debug version of Allegro.

Don Freeman
Member #5,110
October 2004
avatar

clzola said:

I tried this Allegro 5 code on Linux Ubuntu 10.10 (Host OS) using Code::Blocks 10.05 and it works. So I guess, the problem is with Windows XP.... (Tiny version, it could be that :/)

Either that, or try changing the graphics driver settings in virtual box for the vm of xp. (i.e. 3d acceleration)

I don't know if it would help, but you can change your allegro config file from this line:

config_selection=new

To this:

config_selection=old

See if that fixes the problem.

--
"Everyone tells me I should forget about you, you don’t deserve me. They’re right, you don’t deserve me, but I deserve you."
"It’s so simple to be wise. Just think of something stupid to say and then don’t say it."

Thomas Fjellstrom
Member #476
June 2000
avatar

Allegro 5 requires hardware acceleration. If you haven't installed the VirtualBox guest drivers, and the gl support, then Allegro can't run.

If you can get the D3D emulation in VirtualBox working, then it might work in D3D too, but I for one have never managed to get that to work.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

clzola
Member #12,499
January 2011

Here's the log files(attachments)

I have problem with drivers. I make ISO file from ATI Driver CD that I got when I bought a computer. Insert it in Virtual Drive. Click Setup.exe. Click next, next, next, and after a minute, it says the installation is complete. But as I had Windows XP as my OS before Linux, it took more time to install these drivers. And there was a lot of windows to click next next next (install CCC, directx, other drivers, net2.0). Now i have only one. After installing, restart, go to my computer > properties > device manager there is a question mark for some devices (Video Controller and Bass System Device.) I click to update them, and set the directory to search my Virtual CD-ROM. It couldn't find anything ...

Tried ALLEGRO_DIRECT3D and the compiler said, that ALLEGRO_DIRECT3D undefined. So I use ALLEGRO_DIRECT3D_INTERNAL

Same results.... :/

Thomas Fjellstrom
Member #476
June 2000
avatar

You can not use real drivers in VirtualBox. You have to install the "Guest Additions" in order to use any kind of GL or D3D in VirtualBox, and even then, I've never gotten D3D to work.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

clzola
Member #12,499
January 2011

I will reinstall Tiny XP, and first setup all drivers. Then I will try again with Allegro 5.

Can you give me some good tutorials for drivers and other stuff....

Thomas Fjellstrom
Member #476
June 2000
avatar

Just install the VirtualBox Guest Additions. Theres a menu option in VirtualBox itself to start the process.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

clzola
Member #12,499
January 2011

I reinstall Tiny XP. Installed VirtualBox Guest Additional. Now when i started to run Allegro 5 program I got this message:

"The virtual machine window is optimized to work in 32 bit color mode but the virtual display is currently set to 16 bit.

Please open the display properties dialog of the guest OS and select 32 bit color mode, if it is available, for the best performance of the virtual video subsystem.

Note. Some operating systems, like OS/2, may actually work in 32 bit mode but report it as 24bit(16 million colors). You may try to select a different color mode to see it this message disappears or you can simply disable the message now if you are sure the required color mode (32 bit) is not available int the guest OS."

Then I clicked right click on desktop > properties. Go to Settings Tab, to set 32 bit, but there was already 32 bit. I clicked 'Apply'. Try A5 again, and the same result as before. Blinking transparent window.
---

Memory size is 16MB, should I set it to 32MB ?

Matthew Leverton
Supreme Loser
January 1999
avatar

This isn't going to work very well under VirtualBox. You may be able to get OpenGL windows to sort of work if you use the OPENGL flag; I doubt D3D will work at all.

To build and test properly, you'll need to use your host OS.

Go to: