简体   繁体   中英

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?

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.

您需要添加此Project Properties-> Linker-> Input-> Additional Dependencies:编辑并添加以下alld.lib

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM