Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Allegro 4.9.16 Problems...

This thread is locked; no one can reply to it. rss feed Print
Allegro 4.9.16 Problems...
Keeley
Member #11,596
January 2010

Hey after going through some Allegro 4.2 tuts, I decided to upgrade to Allegro 5 but I can't seem to get it working...here's what I did

1.Download the Binary version
2.Extracted the contents
3.Put everything in the lib folder to C:\Program Files\Visual Studio 9.0\VC\lib
3.Put everything in the include folder to
C:\Program Files\Visual Studio 9.0\VC\include
4.I didn't really know where to put the .h so I put it in the include folder
5.Put the .dll file in C:\Program Files\Visual Studio 9.0\VC\bin

Then I start up Visual Studio and I try to do a tutorial

#SelectExpand
1// hello3.c 2// An introduction to bitmaps, input handling 3 4#include <allegro5/allegro5.h> 5#include <allegro5/allegro_image.h> 6#include <stdio.h> 7#include <string.h> 8 9 10float bmp_x=0, bmp_y=0; 11float bmp_dx = 24, bmp_dy = 24; 12ALLEGRO_BITMAP *bmp; 13ALLEGRO_DISPLAY *display; 14 15 16#define KEYPRESSED 0x1 // If key is pressed 17#define KEYNEW 0x2 // If keypress is new 18#define KEYREPEAT 0x4 // If an operating system repeat event is fired 19char key[256]; // 256 bytes is nothing to worry about 20 21 22 23// If a key is pressed down, add it to the key array 24void keydown(ALLEGRO_KEYBOARD_EVENT *kb) { 25 key[kb->keycode] = KEYPRESSED | KEYNEW; 26} 27 28// If a key is released, mark it as unpressed 29// But if it was not yet processed, leave the keynew flag 30void keyup(ALLEGRO_KEYBOARD_EVENT *kb) { 31 key[kb->keycode] &= ~KEYPRESSED; 32} 33 34// If an operating system repeat event comes in, set the flag 35void keyrepeat(ALLEGRO_KEYBOARD_EVENT *kb) { 36 key[kb->keycode] |= KEYREPEAT; 37} 38 39 40// Called once per frame: removes the KEYNEW and KEYREPEAT status from all keys 41void keyupdate() { 42 int i; 43 static int val = ((KEYNEW | KEYREPEAT) << 24) | ((KEYNEW | KEYREPEAT) << 16) | ((KEYNEW | KEYREPEAT) << 8) | KEYNEW | KEYREPEAT; 44 45 for(i=0; i<64; i++) ((int*)key)[i] &= ~val; 46} 47 48// Empties the key buffer 49void keyclear() { 50 memset(key, 0, sizeof(*key)*256); 51} 52 53 54 55// Check for keyboard input 56void keycheck(float dt) { 57 if(key[ALLEGRO_KEY_UP]) bmp_dy -= 64*dt; 58 if(key[ALLEGRO_KEY_DOWN]) bmp_dy += 64*dt; 59 if(key[ALLEGRO_KEY_LEFT]) bmp_dx -= 64*dt; 60 if(key[ALLEGRO_KEY_RIGHT]) bmp_dx += 64*dt; 61} 62 63 64// Updates the game 65void update(float dt) { 66 // Update coordinates 67 bmp_x += bmp_dx*dt; 68 bmp_y += bmp_dy*dt; 69 70 // Make sure bitmap is still on the screen 71 if(bmp_y < 0) { 72 bmp_y = 0; 73 bmp_dy *= -1; 74 } 75 76 if(bmp_x < 0) { 77 bmp_x = 0; 78 bmp_dx *= -1; 79 } 80 81 if(bmp_y > al_get_display_height() - al_get_bitmap_height(bmp)) { 82 bmp_y = al_get_display_height() - al_get_bitmap_height(bmp); 83 bmp_dy *= -1; 84 } 85 86 if(bmp_x > al_get_display_width() - al_get_bitmap_width(bmp)) { 87 bmp_x = al_get_display_width() - al_get_bitmap_width(bmp); 88 bmp_dx *= -1; 89 } 90} 91 92 93void draw() { 94 al_draw_bitmap(bmp, bmp_x, bmp_y, 0); 95} 96 97 98int main(int argc, char *argv[]) { 99 // Initialize Allegro 5 and the font routines 100 al_init(); 101 al_init_image_addon(); 102 103 // Create a window to display things on: 640x480 pixels 104 display = al_create_display(640, 480); 105 if(!display) { 106 printf("Error creating display.\n"); 107 return 1; 108 } 109 110 111 // Install the keyboard handler 112 if(!al_install_keyboard()) { 113 printf("Error installing keyboard.\n"); 114 return 1; 115 } 116 117 118 // Create a color to clear the display with 119 ALLEGRO_COLOR black = al_map_rgba_f(0.0, 0.0, 0.0, 1.0); 120 121 122 // Start a timer to regulate speed: 2 frames per monitor refresh 123 int refresh_rate = al_get_display_refresh_rate(); 124 if(refresh_rate == 0) refresh_rate = 60; 125 126 ALLEGRO_TIMER *timer = al_install_timer(1.0/refresh_rate); 127 al_start_timer(timer); 128 129 130 // Start the event queue to handle keyboard input and our timer 131 ALLEGRO_EVENT_QUEUE *queue = al_create_event_queue(); 132 al_register_event_source(queue, (ALLEGRO_EVENT_SOURCE*)al_get_keyboard_event_source()); 133 al_register_event_source(queue, (ALLEGRO_EVENT_SOURCE*)timer); 134 135 136 // Load our bitmap object 137 bmp = al_load_bitmap("hello.bmp"); 138 if(!bmp) { 139 printf("Error loading hello.bmp\n"); 140 return 1; 141 } 142 143 keyclear(); 144 145 // Move text until the user presses escape 146 ALLEGRO_EVENT event; 147 while(!key[ALLEGRO_KEY_ESCAPE]) { 148 static float old_time=0.0, time, dt; 149 150 // Block until an event enters the queue 151 al_wait_for_event(queue, &event); 152 switch(event.type) { 153 case ALLEGRO_EVENT_KEY_DOWN: 154 keydown(&event.keyboard); 155 break; 156 157 case ALLEGRO_EVENT_KEY_UP: 158 keyup(&event.keyboard); 159 break; 160 161 case ALLEGRO_EVENT_KEY_REPEAT: 162 keyrepeat(&event.keyboard); 163 break; 164 165 case ALLEGRO_EVENT_TIMER: 166 // Determine the change in time between frames, in seconds 167 time = al_current_time(); 168 dt = time-old_time; 169 170 // If the computer lags for some reason, don't penalize the player 171 // Cap dt at 0.25 seconds 172 if(dt > 0.25) dt = 0.25; 173 174 keycheck(dt); 175 update(dt); 176 keyupdate(); 177 178 if(time - event.timer.timestamp <= 1.0/refresh_rate) { 179 // Clear, draw, flip 180 al_clear_to_color(black); 181 draw(); 182 al_flip_display(); 183 } 184 185 186 // Make the time at this frame the old time, for the next frame 187 old_time = time; 188 break; 189 } 190 } 191 192 193 return 0; 194} 195END_OF_MAIN()

And the error I got was
"fatal error C1083: Cannot open include file: 'inttypes.h': No such file or directory"

Any help is aprreciated thanks!

Thomas Fjellstrom
Member #476
June 2000
avatar

Please use <code></code> tags for code :)

Other than that, I'm not entirely sure whats wrong, did you download the right binary package? The mingw version won't likely work with MSVC.

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

Keeley
Member #11,596
January 2010

Oh sorry about that I thought it was [code][/code] I think I DL'd the right one I'll see again

EDIT: As it turns out it was the wrong one ;D thanks
EDIT2: Ok now that I got that to work Visual Studios it asked me where dxguid.lib and dxinput8.lib ( or something like that ) was and I dl'd the libs off a site so now it just gives me a buncha errors I dunno why..
EDIT3: Kay now it just gives me 16 errors now.. I don't get it, I've linked these libs: kernel32.lib user32.lib gdi32.lib comdlg32.lib ole32.lib psapi.lib dinput8.lib d3d9.lib dxguid.lib winmm.lib opengl32.lib
Here's my code and errors...

#SelectExpand
1// hello1.c 2// An introduction to keyboard input and text output 3 4#define ALLEGRO_STATICLINK 1 5 6#include <allegro5/allegro5.h> 7#include <allegro5/allegro_font.h> 8#include <allegro5/allegro_ttf.h> 9#include <stdio.h> 10 11struct Data { 12 ALLEGRO_FONT *f1, *f2; 13 ALLEGRO_DISPLAY *display; 14 ALLEGRO_EVENT_QUEUE *queue; 15 16 ALLEGRO_COLOR bright_green; 17} data; 18 19const char *font_file = "times.ttf"; 20 21 22int main(int argc, char *argv[]) { 23 // Initialize Allegro 5 and the font routines 24 al_init(); 25 al_init_font_addon(); 26 27 // Create a window to display things on: 640x480 pixels 28 data.display = al_create_display(640, 480); 29 if(!data.display) { 30 printf("Error creating display.\n"); 31 return 1; 32 } 33 34 35 // Install the keyboard handler 36 if(!al_install_keyboard()) { 37 printf("Error installing keyboard.\n"); 38 return 1; 39 } 40 41 42 // Load a font 43 data.f1 = al_load_ttf_font(font_file, 48, 0); 44 data.f2 = al_load_ttf_font(font_file, -48, 0); 45 if(!data.f1 || !data.f2) { 46 printf("Error loading \"%s\".\n", font_file); 47 return 1; 48 } 49 50 // Make and set a color to draw with 51 data.bright_green = al_map_rgba_f(0.5, 1.0, 0.5, 1.0); 52 al_set_blender(ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, data.bright_green); 53 54 // Draw a message to the backbuffer in the fonts we just loaded using the color we just set 55 al_draw_text(data.f1, 10, 10, -1, "Allegro 5 Rocks!"); 56 al_draw_text(data.f2, 10, 60, -1, "Allegro 5 Rocks!"); 57 58 // Make the backbuffer visible 59 al_flip_display(); 60 61 // Start the event queue to handle keyboard input 62 data.queue = al_create_event_queue(); 63 al_register_event_source(data.queue, (ALLEGRO_EVENT_SOURCE*)al_get_keyboard_event_source()); 64 65 66 // Wait until the user presses escape 67 ALLEGRO_EVENT event; 68 while(1) { 69 // Block until an event enters the queue 70 al_wait_for_event(data.queue, &event); 71 72 // If the key was escape, then break out of the loop 73 if(event.type == ALLEGRO_EVENT_KEY_DOWN && event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) break; 74 } 75 76 77 return 0; 78} 79END_OF_MAIN()

#SelectExpand
1Linking... 2Linking... 3Bitmaps and Keyboard Input.obj : error LNK2019: unresolved external symbol _al_wait_for_event referenced in function "int __cdecl _mangled_main(int,char * * const)" (?_mangled_main@@YAHHQAPAD@Z) 4Bitmaps and Keyboard Input.obj : error LNK2019: unresolved external symbol _al_register_event_source referenced in function "int __cdecl _mangled_main(int,char * * const)" (?_mangled_main@@YAHHQAPAD@Z) 5Bitmaps and Keyboard Input.obj : error LNK2019: unresolved external symbol _al_get_keyboard_event_source referenced in function "int __cdecl _mangled_main(int,char * * const)" (?_mangled_main@@YAHHQAPAD@Z) 6Bitmaps and Keyboard Input.obj : error LNK2019: unresolved external symbol _al_create_event_queue referenced in function "int __cdecl _mangled_main(int,char * * const)" (?_mangled_main@@YAHHQAPAD@Z) 7Bitmaps and Keyboard Input.obj : error LNK2019: unresolved external symbol _al_flip_display referenced in function "int __cdecl _mangled_main(int,char * * const)" (?_mangled_main@@YAHHQAPAD@Z) 8Bitmaps and Keyboard Input.obj : error LNK2019: unresolved external symbol _al_draw_text referenced in function "int __cdecl _mangled_main(int,char * * const)" (?_mangled_main@@YAHHQAPAD@Z) 9Bitmaps and Keyboard Input.obj : error LNK2019: unresolved external symbol _al_set_blender referenced in function "int __cdecl _mangled_main(int,char * * const)" (?_mangled_main@@YAHHQAPAD@Z) 10Bitmaps and Keyboard Input.obj : error LNK2019: unresolved external symbol _al_map_rgba_f referenced in function "int __cdecl _mangled_main(int,char * * const)" (?_mangled_main@@YAHHQAPAD@Z) 11Bitmaps and Keyboard Input.obj : error LNK2019: unresolved external symbol _al_load_ttf_font referenced in function "int __cdecl _mangled_main(int,char * * const)" (?_mangled_main@@YAHHQAPAD@Z) 12Bitmaps and Keyboard Input.obj : error LNK2019: unresolved external symbol _al_install_keyboard referenced in function "int __cdecl _mangled_main(int,char * * const)" (?_mangled_main@@YAHHQAPAD@Z) 13Bitmaps and Keyboard Input.obj : error LNK2019: unresolved external symbol _al_create_display referenced in function "int __cdecl _mangled_main(int,char * * const)" (?_mangled_main@@YAHHQAPAD@Z) 14Bitmaps and Keyboard Input.obj : error LNK2019: unresolved external symbol _al_init_font_addon referenced in function "int __cdecl _mangled_main(int,char * * const)" (?_mangled_main@@YAHHQAPAD@Z) 15Bitmaps and Keyboard Input.obj : error LNK2019: unresolved external symbol _al_install_system referenced in function "int __cdecl _mangled_main(int,char * * const)" (?_mangled_main@@YAHHQAPAD@Z) 16Bitmaps and Keyboard Input.obj : error LNK2019: unresolved external symbol __WinMain referenced in function _WinMain@16 17MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup 18C:\Documents and Settings\admin\Desktop\1 Bitmaps and Keyboard Input\Debug\1 Bitmaps and Keyboard Input.exe : fatal error LNK1120: 15 unresolved externals 19Build log was saved at "file://c:\Documents and Settings\admin\Desktop\1 Bitmaps and Keyboard Input\1 Bitmaps and Keyboard Input\Debug\BuildLog.htm" 201 Bitmaps and Keyboard Input - 16 error(s), 0 warning(s) 21========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

adamk kromm
Member #5,432
January 2005

you need to link to allegro-4.9.16.lib and allegro_image-4.9.16.lib

----------
-Adam Kromm

My Website

Keeley
Member #11,596
January 2010

K I've tried linking the .libs you told me to it justs says it doesn't know what it was...so I thought maybe I did it wrong so I tried DLing the Binary again and I'll see what happens...

Then I tried using SVN and cmake but I only got as far as right before I start to build and I type in

>cmake C:\allegro -G "Visual Studio 9 2008" -DSHARE=off

But then it justs says it doesn't know what C:\allegro is and means...

so far I'm just linking "kernel32.lib user32.lib gdi32.lib comdlg32.lib ole32.lib psapi.lib dinput8.lib d3d9.lib dxguid.lib winmm.lib opengl32.lib" but in allegro 4.2 I only need to link alld.lib...

Any help would be apreciated, this is making me mad...

adamk kromm
Member #5,432
January 2005

when you run cmake what is the output it gives you?

also if you make you project dynamicaly linked instead of static you wont need to link to kernel32.lib or any of those, just allegro-4.9.16.lib and the other allegro libraries your project requires

----------
-Adam Kromm

My Website

Keeley
Member #11,596
January 2010

Okay now for SVN its not working at all anymore for some reason

"Access is denied"

I'll try to binary version again...
What to you mean dynamically linked?

EDIT2: Okay okay I think I got most of it working now...all my unresolved errors are gone! Too bad that there are still errors...can someone help me with this, it was off a tutorial on Allegro Wiki, maybe I didn't link the right libs again...

#SelectExpand
1// hello1.c 2// An introduction to keyboard input and text output 3#define ALLEGRO_STATICLINK 1 4#include <allegro5/allegro5.h> 5#include <allegro5/allegro_font.h> 6#include <allegro5/allegro_ttf.h> 7#include <stdio.h> 8 9struct Data { 10 ALLEGRO_FONT *f1, *f2; 11 ALLEGRO_DISPLAY *display; 12 ALLEGRO_EVENT_QUEUE *queue; 13 14 ALLEGRO_COLOR bright_green; 15} data; 16 17const char *font_file = "times.ttf"; 18 19 20int main(int argc, char *argv[]) { 21 // Initialize Allegro 5 and the font routines 22 al_init(); 23 al_init_font_addon(); 24 25 // Create a window to display things on: 640x480 pixels 26 data.display = al_create_display(640, 480); 27 if(!data.display) { 28 printf("Error creating display.\n"); 29 return 1; 30 } 31 32 33 // Install the keyboard handler 34 if(!al_install_keyboard()) { 35 printf("Error installing keyboard.\n"); 36 return 1; 37 } 38 39 40 // Load a font 41 data.f1 = al_load_ttf_font(font_file, 48, 0); 42 data.f2 = al_load_ttf_font(font_file, -48, 0); 43 if(!data.f1 || !data.f2) { 44 printf("Error loading \"%s\".\n", font_file); 45 return 1; 46 } 47 48 // Make and set a color to draw with 49 data.bright_green = al_map_rgba_f(0.5, 1.0, 0.5, 1.0); 50 al_set_blender(ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, data.bright_green); 51 52 // Draw a message to the backbuffer in the fonts we just loaded using the color we just set 53 al_draw_text(data.f1, 10, 10, -1, "Allegro 5 Rocks!"); 54 al_draw_text(data.f2, 10, 60, -1, "Allegro 5 Rocks!"); 55 56 // Make the backbuffer visible 57 al_flip_display(); 58 59 // Start the event queue to handle keyboard input 60 data.queue = al_create_event_queue(); 61 al_register_event_source(data.queue, (ALLEGRO_EVENT_SOURCE*)al_get_keyboard_event_source()); 62 63 64 // Wait until the user presses escape 65 ALLEGRO_EVENT event; 66 while(1) { 67 // Block until an event enters the queue 68 al_wait_for_event(data.queue, &event); 69 70 // If the key was escape, then break out of the loop 71 if(event.type == ALLEGRO_EVENT_KEY_DOWN && event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) break; 72 } 73 74 75 return 0; 76} 77END_OF_MAIN()

#SelectExpand
1------ Build started: Project: Test, Configuration: Debug Win32 ------ 2Compiling... 3hello1.c 4c:\documents and settings\admin\desktop\hello1.c(65) : error C2275: 'ALLEGRO_EVENT' : illegal use of this type as an expression 5 c:\allegro\include\allegro5\events.h(194) : see declaration of 'ALLEGRO_EVENT' 6c:\documents and settings\admin\desktop\hello1.c(65) : error C2146: syntax error : missing ';' before identifier 'event' 7c:\documents and settings\admin\desktop\hello1.c(65) : error C2065: 'event' : undeclared identifier 8c:\documents and settings\admin\desktop\hello1.c(68) : error C2065: 'event' : undeclared identifier 9c:\documents and settings\admin\desktop\hello1.c(68) : warning C4133: 'function' : incompatible types - from 'int *' to 'ALLEGRO_EVENT *' 10c:\documents and settings\admin\desktop\hello1.c(71) : error C2065: 'event' : undeclared identifier 11c:\documents and settings\admin\desktop\hello1.c(71) : error C2224: left of '.type' must have struct/union type 12c:\documents and settings\admin\desktop\hello1.c(71) : error C2065: 'event' : undeclared identifier 13c:\documents and settings\admin\desktop\hello1.c(71) : error C2224: left of '.keyboard' must have struct/union type 14Build log was saved at "file://c:\Documents and Settings\admin\Desktop\Test\Test\Debug\BuildLog.htm" 15Test - 8 error(s), 1 warning(s) 16========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Also adamk kromm what do you mean alleg-4.16libs? Like these?

allegro_audio-static-4.9.16.lib
allegro_color-static-4.9.16.lib
allegro_dialog-static-4.9.16.lib
allegro_flac-static-4.9.16.lib
allegro_font-static-4.9.16.lib
allegro_image-static-4.9.16.lib
allegro_memfile-static-4.9.16.lib
allegro_physfs-static-4.9.16.lib
allegro_primitives-static-4.9.16.lib
allegro_ttf-static-4.9.16.lib
allegro_vorbis-static-4.9.16.lib
allegro-static-4.9.16.lib

Thanks for all you help guys and please bear with me, I have a feeling we're almost there...;D

Peter Wang
Member #23
April 2000

With older versions of C you cannot define a variable in the middle of a block, e.g. line 65.

Keeley
Member #11,596
January 2010

So its just the tutorials fault...okay!

EDIT: It clearly shows that the tutorials are out of date my bad...I'll just sprite rip till a good tutorial comes out then...:-/

Evert
Member #794
November 2000
avatar

Keeley said:

So its just the tutorials fault...okay!

One could also argue that it's MSVC's fault for not supporting C99.

One possible work-around is to compile your code as C++ code. The alternative is to move the declarations to the top of the scope where they are used (which is where they belong anyway :P).

Keeley
Member #11,596
January 2010

Good point ;D I'll try doing that after I read the tuts

EDIT:Now that i read through some I its fine when I type something like this..

//Testing, hope this works...

#define ALLEGRO_STATICLINK 1
#include <allegro5/allegro5.h>
#include <allegro5/allegro_image.h>

int main( int argc, char *argv[])
{
  al_init();
  al_create_display(640, 480);

  return 0;
}
END_OF_MAIN()

And linking these files...

allegro-static-4.9.16.lib
kernel32.lib
user32.lib
gdi32.lib
comdlg32.lib
ole32.lib
psapi.lib
dinput8.lib
d3d9.lib
dxguid.lib
winmm.lib
opengl32.lib

But when I try to do other things like this:

#SelectExpand
1 //Testing, hope this works... 2 3#define ALLEGRO_STATICLINK 1 4#include <allegro5/allegro5.h> 5#include <allegro5/allegro_image.h> 6 7int main( int argc, char *argv[]) 8{ 9 al_init(); 10 al_init_image_addon(); 11 al_create_display(640, 480); 12 13 ALLEGRO_BITMAP *hello_world = NULL; 14 hello_world = al_load_bitmap("hello_world.bmp"); 15 16 return 0; 17} 18END_OF_MAIN()

I gives me an unresolved error :o so I link like this:

allegro-static-4.9.16.lib
allegro_image-static-4.9.16.lib
kernel32.lib
user32.lib
gdi32.lib
comdlg32.lib
ole32.lib
psapi.lib
dinput8.lib
d3d9.lib
dxguid.lib
winmm.lib
opengl32.lib

but it just gives me these errors any ideas? ( Sorry I'm such a noob at this -_-|)

#SelectExpand
1------ Build started: Project: Test, Configuration: Debug Win32 ------ 2Linking... 3LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library 4allegro_image-static-4.9.16.lib(jpg.obj) : error LNK2019: unresolved external symbol _jpeg_resync_to_restart referenced in function _jpeg_packfile_src 5allegro_image-static-4.9.16.lib(jpg.obj) : error LNK2019: unresolved external symbol _jpeg_destroy_decompress referenced in function _load_jpg_entry_helper 6allegro_image-static-4.9.16.lib(jpg.obj) : error LNK2019: unresolved external symbol _jpeg_finish_decompress referenced in function _load_jpg_entry_helper 7allegro_image-static-4.9.16.lib(jpg.obj) : error LNK2019: unresolved external symbol _jpeg_read_scanlines referenced in function _load_jpg_entry_helper 8allegro_image-static-4.9.16.lib(jpg.obj) : error LNK2019: unresolved external symbol _jpeg_start_decompress referenced in function _load_jpg_entry_helper 9allegro_image-static-4.9.16.lib(jpg.obj) : error LNK2019: unresolved external symbol _jpeg_read_header referenced in function _load_jpg_entry_helper 10allegro_image-static-4.9.16.lib(jpg.obj) : error LNK2019: unresolved external symbol _jpeg_CreateDecompress referenced in function _load_jpg_entry_helper 11allegro_image-static-4.9.16.lib(jpg.obj) : error LNK2019: unresolved external symbol _jpeg_std_error referenced in function _load_jpg_entry_helper 12allegro_image-static-4.9.16.lib(jpg.obj) : error LNK2019: unresolved external symbol _jpeg_destroy_compress referenced in function _save_jpg_entry_helper 13allegro_image-static-4.9.16.lib(jpg.obj) : error LNK2019: unresolved external symbol _jpeg_finish_compress referenced in function _save_jpg_entry_helper 14allegro_image-static-4.9.16.lib(jpg.obj) : error LNK2019: unresolved external symbol _jpeg_write_scanlines referenced in function _save_jpg_entry_helper 15allegro_image-static-4.9.16.lib(jpg.obj) : error LNK2019: unresolved external symbol _jpeg_start_compress referenced in function _save_jpg_entry_helper 16allegro_image-static-4.9.16.lib(jpg.obj) : error LNK2019: unresolved external symbol _jpeg_set_defaults referenced in function _save_jpg_entry_helper 17allegro_image-static-4.9.16.lib(jpg.obj) : error LNK2019: unresolved external symbol _jpeg_CreateCompress referenced in function _save_jpg_entry_helper 18allegro_image-static-4.9.16.lib(png.obj) : error LNK2019: unresolved external symbol _png_error referenced in function _read_data 19allegro_image-static-4.9.16.lib(png.obj) : error LNK2019: unresolved external symbol _png_get_io_ptr referenced in function _read_data 20allegro_image-static-4.9.16.lib(png.obj) : error LNK2019: unresolved external symbol _png_sig_cmp referenced in function _check_if_png 21allegro_image-static-4.9.16.lib(png.obj) : error LNK2019: unresolved external symbol _png_read_end referenced in function _really_load_png 22allegro_image-static-4.9.16.lib(png.obj) : error LNK2019: unresolved external symbol _png_read_row referenced in function _really_load_png 23allegro_image-static-4.9.16.lib(png.obj) : error LNK2019: unresolved external symbol _png_get_rowbytes referenced in function _really_load_png 24allegro_image-static-4.9.16.lib(png.obj) : error LNK2019: unresolved external symbol _png_get_PLTE referenced in function _really_load_png 25allegro_image-static-4.9.16.lib(png.obj) : error LNK2019: unresolved external symbol _png_read_update_info referenced in function _really_load_png 26allegro_image-static-4.9.16.lib(png.obj) : error LNK2019: unresolved external symbol _png_set_interlace_handling referenced in function _really_load_png 27allegro_image-static-4.9.16.lib(png.obj) : error LNK2019: unresolved external symbol _png_set_gamma referenced in function _really_load_png 28allegro_image-static-4.9.16.lib(png.obj) : error LNK2019: unresolved external symbol _png_get_gAMA referenced in function _really_load_png 29allegro_image-static-4.9.16.lib(png.obj) : error LNK2019: unresolved external symbol _png_get_sRGB referenced in function _really_load_png 30allegro_image-static-4.9.16.lib(png.obj) : error LNK2019: unresolved external symbol _png_set_gray_to_rgb referenced in function _really_load_png 31allegro_image-static-4.9.16.lib(png.obj) : error LNK2019: unresolved external symbol _png_set_strip_16 referenced in function _really_load_png 32allegro_image-static-4.9.16.lib(png.obj) : error LNK2019: unresolved external symbol _png_set_tRNS_to_alpha referenced in function _really_load_png 33allegro_image-static-4.9.16.lib(png.obj) : error LNK2019: unresolved external symbol _png_get_valid referenced in function _really_load_png 34allegro_image-static-4.9.16.lib(png.obj) : error LNK2019: unresolved external symbol _png_set_expand referenced in function _really_load_png 35allegro_image-static-4.9.16.lib(png.obj) : error LNK2019: unresolved external symbol _png_set_packing referenced in function _really_load_png 36allegro_image-static-4.9.16.lib(png.obj) : error LNK2019: unresolved external symbol _png_get_IHDR referenced in function _really_load_png 37allegro_image-static-4.9.16.lib(png.obj) : error LNK2019: unresolved external symbol _png_read_info referenced in function _really_load_png 38allegro_image-static-4.9.16.lib(png.obj) : error LNK2019: unresolved external symbol _png_set_sig_bytes referenced in function _al_load_png_stream 39allegro_image-static-4.9.16.lib(png.obj) : error LNK2019: unresolved external symbol _png_set_read_fn referenced in function _al_load_png_stream 40allegro_image-static-4.9.16.lib(png.obj) : error LNK2019: unresolved external symbol _png_destroy_read_struct referenced in function _al_load_png_stream 41allegro_image-static-4.9.16.lib(png.obj) : error LNK2019: unresolved external symbol _png_create_info_struct referenced in function _al_load_png_stream 42allegro_image-static-4.9.16.lib(png.obj) : error LNK2019: unresolved external symbol _png_create_read_struct referenced in function _al_load_png_stream 43allegro_image-static-4.9.16.lib(png.obj) : error LNK2019: unresolved external symbol _png_write_row referenced in function _save_rgba 44allegro_image-static-4.9.16.lib(png.obj) : error LNK2019: unresolved external symbol _png_write_end referenced in function _al_save_png_stream 45allegro_image-static-4.9.16.lib(png.obj) : error LNK2019: unresolved external symbol _png_destroy_write_struct referenced in function _al_save_png_stream 46allegro_image-static-4.9.16.lib(png.obj) : error LNK2019: unresolved external symbol _png_write_info referenced in function _al_save_png_stream 47allegro_image-static-4.9.16.lib(png.obj) : error LNK2019: unresolved external symbol _png_set_IHDR referenced in function _al_save_png_stream 48allegro_image-static-4.9.16.lib(png.obj) : error LNK2019: unresolved external symbol _png_set_compression_level referenced in function _al_save_png_stream 49allegro_image-static-4.9.16.lib(png.obj) : error LNK2019: unresolved external symbol _png_set_write_fn referenced in function _al_save_png_stream 50allegro_image-static-4.9.16.lib(png.obj) : error LNK2019: unresolved external symbol _png_create_write_struct referenced in function _al_save_png_stream 51C:\Documents and Settings\admin\Desktop\Test\Debug\Test.exe : fatal error LNK1120: 47 unresolved externals 52Build log was saved at "file://c:\Documents and Settings\admin\Desktop\Test\Test\Debug\BuildLog.htm" 53Test - 48 error(s), 1 warning(s)

Trent Gamblin
Member #261
April 2000
avatar

Link to png.lib and jpeg.lib too.

Keeley
Member #11,596
January 2010

Oh thanks, um I could make some tutorials if you want, though they won't be the best ;D... it would look something like this, with more explanation of course...

#SelectExpand
1//Testing, hope this works... 2 3#define ALLEGRO_STATICLINK 1 4#include <allegro5/allegro5.h> 5#include <allegro5/allegro_image.h> 6 7int main( int argc, char *argv[]) 8{ 9 al_init(); 10 al_init_image_addon(); 11 ALLEGRO_DISPLAY *Screen = al_create_display(640, 480); 12 13 ALLEGRO_BITMAP *hello_world = NULL; 14 hello_world = al_load_bitmap("hello_world.bmp"); 15 16 al_draw_bitmap(hello_world, 0,0, 0); 17 18 al_flip_display(); 19 al_rest(5); 20 21 22 al_destroy_bitmap(hello_world); 23 return 0; 24} 25END_OF_MAIN()

Trent Gamblin
Member #261
April 2000
avatar

I suppose a simple hello world program in 4.9 would fit on the wiki, if there isn't one there already.

Keeley
Member #11,596
January 2010

There is already one, just its out of date :P

Trent Gamblin
Member #261
April 2000
avatar

Well then an update would be appreciated. :)

Keeley
Member #11,596
January 2010

Ahh I can't seem to find out whats wrong with adding keyboard support >:( Can anyone help?

#SelectExpand
1//Keyboard Input 2 3#define ALLEGRO_STATICLINK 1 4#include <allegro5/allegro5.h> 5#include <allegro5/allegro_image.h> 6 7int main( int argc, char *argv[]) 8{ 9 al_init();; 10 al_install_keyboard(); 11 12 ALLEGRO_DISPLAY *screen = al_create_display(640, 480); 13 14 ALLEGRO_BITMAP *hello_world = NULL; 15 hello_world = al_load_bitmap("hello_world"); 16 17 int hello_world_x = 0; 18 int hello_world_y = 0; 19 20 21 while(ALLEGRO_EVENT_KEY_DOWN) 22 { 23 while(!ALLEGRO_KEY_ESCAPE) 24 { 25 if(ALLEGRO_KEY_RIGHT) 26 hello_world_x ++; 27 if(ALLEGRO_KEY_LEFT) 28 hello_world_x --; 29 if(ALLEGRO_KEY_UP) 30 hello_world_y --; 31 if(ALLEGRO_KEY_DOWN) 32 hello_world_y ++; 33 } 34 } 35 36 37 al_draw_bitmap(hello_world, hello_world_x, hello_world_y, 0); 38 al_flip_display(); 39 40al_destroy_bitmap(hello_world); 41return 0; 42} 43END_OF_MAIN()

It doesn't give me errors or anything it justs doesn't exit when I press ESC and it doesn't display anything...the reference manual hard to understand :(

Thomas Fjellstrom
Member #476
June 2000
avatar

You might want to check the examples. That is NOT how you use the event api.

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

Keeley
Member #11,596
January 2010

Oh okay, I tried to follow the 4.2 format, I'll check the examples

Go to: