Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Allegro 4.4.2 Causing Linker Error

This thread is locked; no one can reply to it. rss feed Print
Allegro 4.4.2 Causing Linker Error
AceBlkwell
Member #13,038
July 2011
avatar

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
avatar

AceBlkwell
Member #13,038
July 2011
avatar

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 */
#ifndef SCAN_EXPORT
#ifndef SCAN_DEPEND
#include "allegro/platform/alplatf.h"
#endif

[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 ***
I realized the alplatf.h just says #define ALLEGRO_MINGW32. I added the define and
commented out the ifndef block. When it got to
#elif defined ALLEGRO_MINGW32
#include "allegro/platform/almngw32.h"
If couldn't find that file either. So it seems the compiler simply can't find "allegro/platform" I'll keep adding it to different areas of the editor and compiler. Let me know if I'm overlooking something obvious.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

AceBlkwell
Member #13,038
July 2011
avatar

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
avatar

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
I tested some code here :

#SelectExpand
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
It worked for me without a window.

AceBlkwell
Member #13,038
July 2011
avatar

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

----------------------
Process exited after 0.1602 seconds with return value of 32221225781
Press any key to continue ...

_____________________________________________________________

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
not found. Reinstalling the program may fix this problem.

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
avatar

Go to: