rmaes4
rmaes4

Reputation: 565

How to link allegro 4.4 with visual studio 2010

I have been trying for several hours now to link allegro 4.4 with visual studio 2010. I am using microsoft visual C++ 2010 express edition. Here is what I did:

  1. I downloaded the windows binaries from http://www.allegro.cc/files/?v=4.4 (I downloaded the MSVC 2010 one)

  2. I extracted the three folders in the zip archive to the following location "C:\allegro"

  3. I launched MSVC and created a new windows console application

  4. I created a main.cpp file

  5. In the project properties I went to VC++ directories and set Include Directories to "C:\allegro\include"

  6. In VC++ directories I set Library Directories to "C:\allegro\lib"

  7. In Linker->Input I added "allegro-4.4.2-md.lib" to the additional dependencies.

  8. In Configuration Properties->Debugging I set 'enviorment' to "PATH=c:\allegro\bin;%PATH%"

  9. I applied all the changes and entered this simple program into main.cpp

    #include <allegro.h>
    int main()
    {
        return 0;
    }
    END_OF_MAIN();
    
  10. When I tried to debug it I got two errors Error 1 error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup and Error 2 error LNK1120: 1 unresolved externals

I've been pulling my hair out in frustration! Can someone please help me out or point me in the right direction?

Upvotes: 3

Views: 3936

Answers (2)

Mina Wissa
Mina Wissa

Reputation: 10971

You need to add this Project Properties->Linker->Input->Additional Dependencies: edit and add the following alld.lib

Upvotes: 1

rmaes4
rmaes4

Reputation: 565

Well I feel like an idiot now but I figured it out after reading http://www.allegro.cc/manual/4/miscellaneous/frequently-asked-questions-(faq)/windows-problems/d4cf0624ded68003a11b4892102bbc66. I realized the problem is that I created a console application rather than a window application. I fixed this by going to Configuration Properties -> Linker -> System and setting SubSystem to "Windows (/SUBSYSTEM:WINDOWS)" I hope this helps any else who runs into this problem.

Upvotes: 1

Related Questions