Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » I have problem when I compile my little program

This thread is locked; no one can reply to it. rss feed Print
I have problem when I compile my little program
MilanesaNapo
Member #16,150
January 2016

This is my little program, it basic but is something :).

#include <stdio.h>
#include <allegro5/allegro.h>
#include <stdlib.h>

main()
{

al_init();
extern char allegro_id[];
printf("%c",allegro_id);
exit(0);
}

And here is my problem that i can't solve:

[Linker error] undefined reference to `allegro_id'
ld returned 1 exit status

You now wich could be the problem?

bamccaig
Member #7,536
July 2006
avatar

I'm not sure that Allegro 5 has an allegro_id. Searches all reference Allegro 4. A different, incompatible version of the library. There is an al_get_allegro_version function that returns a packed integer... I assume that would be similar in purpose. What is it that you wanted allegro_id for?

GullRaDriel
Member #3,861
September 2003
avatar

Because you declared it extern.
EDIT: wait, no. Don't know.

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

MilanesaNapo
Member #16,150
January 2016

The problem is that i don't know what is the allegro_id, if it is a file that is missing or doesn't exist. I try with an example downloaded from web and it gave me the same problem.

bamccaig
Member #7,536
July 2006
avatar

MilanesaNapo
Member #16,150
January 2016

ok, i am going to try it

[EDIT 1]

Okay,i try with another example but the error is the same. What do you recomend me to do?

Thanks for your help and attention.

SiegeLord
Member #7,827
October 2006
avatar

Your examples are for Allegro 4. Where are you getting them?

Allegro 5 has some tutorials here: https://wiki.allegro.cc/index.php?title=Getting_Started#Tutorials

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Go to: