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:
I downloaded the windows binaries from http://www.allegro.cc/files/?v=4.4 (I downloaded the MSVC 2010 one)
I extracted the three folders in the zip archive to the following location "C:\\allegro"
I launched MSVC and created a new windows console application
I created a main.cpp file
In the project properties I went to VC++ directories and set Include Directories to "C:\\allegro\\include"
In VC++ directories I set Library Directories to "C:\\allegro\\lib"
In Linker->Input I added "allegro-4.4.2-md.lib" to the additional dependencies.
In Configuration Properties->Debugging I set 'enviorment' to "PATH=c:\\allegro\\bin;%PATH%"
I applied all the changes and entered this simple program into main.cpp
#include <allegro.h> int main() { return 0; } END_OF_MAIN();
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.