|
Allegro 4.4.2 Causing Linker Error |
AceBlkwell
Member #13,038
July 2011
|
I'm trying to test an idea that uses readkey(). When I include allegro and use liballeg.a , even if I don't use any allegro commands, I get an error. If I comment the #include out, the program links fine. Anyone have any idea what I'm missing? Error is listed in the included picture. Thank You, |
Edgar Reynaldo
Major Reynaldo
May 2007
|
You forgot END_OF_MAIN() Or you didn't define ALLEGRO_STATICLINK That or you didn't set your include search directories properly. Probably this^ My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
AceBlkwell
Member #13,038
July 2011
|
Thanks Edgar. Can't believe I forgot END_MAIN(). Now the issue is alconfig.h can't find the other "include" files. I've added the directory to the compiler's path and to the project itself and have physically seen the file. Still get the same error /* include platform-specific stuff */ [Error] allegro/platform/alplatf.h No such file or directory. BTW this isn't a new installation. I have compile allegro stuff out of here before. Thanks for any help. Ace *** UPDATE *** |
Edgar Reynaldo
Major Reynaldo
May 2007
|
You don't get the al_platf header unless you build and install it yourself. Otherwise it should come with your binaries. You have to run the install target of make or nmake or vs or whatever. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
AceBlkwell
Member #13,038
July 2011
|
Thanks Edgar, I deleted Dev and Allegro. Reinstalled. That cleaned up some of the path issues. Eventually I realized I have a 64 Vs 32bit issue. I compiled at 32 and it compiled fine. Issue now is it doesn't print anything to screen. I don't have any errors or warnings. The console screen just shows it ran fine, just no output. If I'm going to use Allegro for the readkey or keypressed option, do I need to set up a graphics mode and output text to some sort of textprintf_ex command? I'm just trying to watch data print to screen while waiting on a key press. I assumed I wouldn't need graphics modes and text outputs at this point. I was assuming I only needed to install keyboard and use !keypressed(). It's not been that easy. Any insight you might have would be appreciated. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
If you can, make a simple test program that demonstrates this. I will test on my own. I can't remember what the requirements for using a keyboard are. I think you can get by with SYSTEM_NONE but I don't recall. Post your code and your compile options and the output of the linker and compiler and maybe I can help. EDIT1 1
2
3
4
5#include "allegro.h"
6
7#include <cstdio>
8
9
10
11int main(int argc , char** argv) {
12
13 (void)argc;
14 (void)argv;
15
16 if (allegro_init() != 0) {
17 printf("Failed to init allegro 4.\n");
18 return -1;
19 }
20
21 if (install_timer() != 0) {
22 printf("Failed to install timer.\n");
23 return -10;
24 }
25 if (install_keyboard() != 0) {
26 printf("Failed to install keyboard.\n");
27 return -11;
28 }
29 /* We are not 100% sure we can read the keyboard yet! */
30 if (set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0) != 0)
31 printf("Couldn't set graphic mode!\n");
32
33 printf("Output?\n");
34
35 /* Now we are guaranteed to be able to read the keyboard. */
36 int k = readkey();
37
38 printf("Key read = %d\n" , k);
39
40 return 0;
41}
42END_OF_MAIN()
and it compiled and ran correctly. The output was "Output?" and "Key read = 19232" I DID have to open a graphics window, but the console continued to work. You can always hide the window by moving it offscreen. EDIT2 My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
AceBlkwell
Member #13,038
July 2011
|
Thanks for going through the trouble Edgar. Same result I'm afraid. I added the liballeg.a directory to the projects LIB path and the allegro.h directory to the projects INCLUDE path. The program compiled and ran. But no output or error. ______________________________________________________________ The console screen output shows ---------------------- _____________________________________________________________ So I ran the program EXE file independently from Windows (outside the IDE) I got an error X The code execution cannot proceed because alleg42.dll was After a little research, I dug around and found the alleg42.dll file in the BIN directory. I copied it to the project directory and both my copy and yours worked from Windows and the IDE. Thanks again for the help. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Your post title says Allegro 4.4.2, but you say you're using Allegro 4.2. If you compiled with Allegro 4.4, you need alleg44.dll, fyi. But anyway, glad you got it working. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
|