allegto 4 lib files

This is a discussion on allegto 4 lib files within the Game Programming forums, part of the General Programming Boards category; what lib files do you need to include to get an allegro 4 program to compile. Heres some code included ...

  1. #1
    bobish
    Guest

    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)

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    375
    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
    Last edited by Justin W; 02-02-2002 at 09:10 AM.
    Allegro precompiled Installer for Dev-C++, MSVC, and Borland: http://galileo.spaceports.com/~springs/

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Reading .dat files from a folder in current directory...
    By porsche911nfs in forum C++ Programming
    Replies: 7
    Last Post: 04-04-2009, 10:52 PM
  2. Error opening files in a different dir
    By Ozzie in forum C++ Programming
    Replies: 3
    Last Post: 10-09-2008, 07:55 AM
  3. Working with muliple source files
    By Swarvy in forum C++ Programming
    Replies: 1
    Last Post: 10-02-2008, 09:36 AM
  4. Folding@Home Cboard team?
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 398
    Last Post: 10-11-2005, 09:44 AM
  5. Batch file programming
    By year2038bug in forum Tech Board
    Replies: 10
    Last Post: 09-05-2005, 04:30 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21