Hey, guys. I'm having significant problems with compiling basic programs. I'd really appreciate any help you can offer!
When I try to compile an Allegro program using KDevelop or by directly calling gcc at the command line, I get a long stream of "undefined reference" errors. The programs I'm compiling are literally "Hello World" programs plus the most basic framework for an Allegro program.
I have Allegro 4.2.0 installed, and I've tried compiling from the official Linux source code as well as from Adept's packages--I've also tried 4.1 with the same results.
This most basic program compiles perfectly (I'm using KDevelop for all compilations, unless otherwise specified) :
#include <allegro.h>
int main(void) {
return EXIT_SUCCESS;
}
However, when I add the basic structure for an Allegro program:
#include <allegro.h>
int main(void) {
allegro_init();
return EXIT_SUCCESS;
}
END_OF_MAIN()
The compile log reads:
cd '/home/dylan/tronwar/debug' && WANT_AUTOCONF_2_5="1" WANT_AUTOMAKE_1_6="1" make -k
make all-recursive
Making all in src
g++ -DHAVE_CONFIG_H -I. -I/home/dylan/tronwar/src -I.. -O0 -g3 -c /home/dylan/tronwar/src/tronwar.cpp
/bin/sh ../libtool --mode=link g++ -O0 -g3 -o tronwar tronwar.o
g++ -O0 -g3 -o tronwar tronwar.o
tronwar.o: In function `install_allegro':/usr/include/allegro/system.h:81: undefined reference to `_get_allegro_version'
:/usr/include/allegro/system.h:81: undefined reference to `get_config_text'
:/usr/include/allegro/system.h:81: undefined reference to `allegro_error'
:/usr/include/allegro/system.h:81: undefined reference to `ustrzcpy'
:/usr/include/allegro/system.h:81: undefined reference to `_install_allegro'
collect2: ld returned 1 exit status
make[2]: *** [tronwar] Error 1
make[2]: Target `all' not remade because of errors.
make[2]: Nothing to be done for `all-am'.
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive-am] Error 2
make: Target `all' not remade because of errors.
*** Exited with status: 2 ***
The result is the same with a ; after END_OF_MAIN() -- Allegro's documentation does not include the trailing ;.
Allegro's headers are installed to /usr/include/allegro/, with the exception of allegro.h, which is located in /usr/include. allegro/ has permissions 755, owner root, group root.
Previously, I recall being unable to successfully compile an SDL program because the compiler did not look in /usr/include/SDL to find the SDL headers, and after adding symbolic links to those files in /usr/include, I thought I recalled not being able to compile still, due to undefined reference errors. I just tried, however, and the KDevelop SDL program template compiled beautifully--I'm not sure what to make of that.
It's tempting to draw a parallel between the two problems, but considering that the Allegro errors cited involve line 81 of system.h and not the lack of the system.h file itself, I don't know if the problem I had with SDL is involved.
A final note: creating symbolic links in /usr/include to each file in /usr/include/allegro has no effect on the Allegro compile error. I've just removed said links to simplify troubleshooting.
I'm out of ideas after almost a week of searching for answers online, here and elsewhere. I'm very grateful for any help you can offer me--thank you for your assistance!
The fact that I am unable to compile an Allegro program similar to the one above using my Windows Professional x64 computer (error regarding WinMain) may indicate something I'm doing wrong, but since it's x64, it may just be an incompatibility.
When I try to compile an Allegro program using KDevelop or by directly calling gcc at the command line, I get a long stream of "undefined reference" errors. The programs I'm compiling are literally "Hello World" programs plus the most basic framework for an Allegro program.
I have Allegro 4.2.0 installed, and I've tried compiling from the official Linux source code as well as from Adept's packages--I've also tried 4.1 with the same results.
This most basic program compiles perfectly (I'm using KDevelop for all compilations, unless otherwise specified) :
#include <allegro.h>
int main(void) {
return EXIT_SUCCESS;
}
However, when I add the basic structure for an Allegro program:
#include <allegro.h>
int main(void) {
allegro_init();
return EXIT_SUCCESS;
}
END_OF_MAIN()
The compile log reads:
cd '/home/dylan/tronwar/debug' && WANT_AUTOCONF_2_5="1" WANT_AUTOMAKE_1_6="1" make -k
make all-recursive
Making all in src
g++ -DHAVE_CONFIG_H -I. -I/home/dylan/tronwar/src -I.. -O0 -g3 -c /home/dylan/tronwar/src/tronwar.cpp
/bin/sh ../libtool --mode=link g++ -O0 -g3 -o tronwar tronwar.o
g++ -O0 -g3 -o tronwar tronwar.o
tronwar.o: In function `install_allegro':/usr/include/allegro/system.h:81: undefined reference to `_get_allegro_version'
:/usr/include/allegro/system.h:81: undefined reference to `get_config_text'
:/usr/include/allegro/system.h:81: undefined reference to `allegro_error'
:/usr/include/allegro/system.h:81: undefined reference to `ustrzcpy'
:/usr/include/allegro/system.h:81: undefined reference to `_install_allegro'
collect2: ld returned 1 exit status
make[2]: *** [tronwar] Error 1
make[2]: Target `all' not remade because of errors.
make[2]: Nothing to be done for `all-am'.
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive-am] Error 2
make: Target `all' not remade because of errors.
*** Exited with status: 2 ***
The result is the same with a ; after END_OF_MAIN() -- Allegro's documentation does not include the trailing ;.
Allegro's headers are installed to /usr/include/allegro/, with the exception of allegro.h, which is located in /usr/include. allegro/ has permissions 755, owner root, group root.
Previously, I recall being unable to successfully compile an SDL program because the compiler did not look in /usr/include/SDL to find the SDL headers, and after adding symbolic links to those files in /usr/include, I thought I recalled not being able to compile still, due to undefined reference errors. I just tried, however, and the KDevelop SDL program template compiled beautifully--I'm not sure what to make of that.
It's tempting to draw a parallel between the two problems, but considering that the Allegro errors cited involve line 81 of system.h and not the lack of the system.h file itself, I don't know if the problem I had with SDL is involved.
A final note: creating symbolic links in /usr/include to each file in /usr/include/allegro has no effect on the Allegro compile error. I've just removed said links to simplify troubleshooting.
I'm out of ideas after almost a week of searching for answers online, here and elsewhere. I'm very grateful for any help you can offer me--thank you for your assistance!
The fact that I am unable to compile an Allegro program similar to the one above using my Windows Professional x64 computer (error regarding WinMain) may indicate something I'm doing wrong, but since it's x64, it may just be an incompatibility.
Comment