-
allegto 4 lib files
what lib files do you need to include to get an allegro 4 program to compile. Heres some code included with an allegro tutorial:
#include <stdio.h>
#include <allegro.h>
int main (void)
{
allegro_init();
check_cpu();
printf("\nAllegro reports OK!\n");
printf("\nThis test was compiled with %s\n",allegro_id);
printf("Your CPU Vendor : %s\n",cpu_vendor);
return 0;
}
END_OF_MAIN()
i am currently including:
alld.lib
alleg.lib
allp.lib
which are the only lib files included in the msvc folder Im using MSVC++ 6.0
heres my error message I got more errors before adding the .libs mentioned above
--------------------Configuration: test - Win32 Debug--------------------
Compiling...
test.c
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/test.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
test.exe - 2 error(s), 0 warning(s)
-
alld is a debugger lib, and allp if for a profiler. Only include one of them (say alleg.lib or for your debugger, alld.lib). Be sure you are making a Windows app, and not a console program. Otherwise, that is all you have to link in for the .dll version (the version dependent upon the Allegro.dll file to be in the path or same directory as the executable).
To static link the lib, which puts into your executable any parts of the .DLL which it uses, which reduces the size of your distribution and makes your program completely independent from the Allegro.DLL, use alleg_s.lib or alld_s.lib.
Here's the linker and compiler options I use for that.
Linker:
-lalleg_s -lgdi32 -ldxguid -lole32 -ldinput -lddraw -lwinmm -ldsound
Compiler:
-DALLEGRO_STATICLINK
Some people have found that their versions of MSVC require you to #define ALLEGRO_STATICLINK at the start of your program for everything to go smoothly as well. I haven't ever needed it in any tool, but it is now in the Allegro documents for MSVC, so it probably isn't a bad idea.
Linking statically is a touch more hassle, but only with the setup. The rest of your code will look identical.
Hope that helps.
-Justin