I return to the embrace of allegro and the setup of it in VS2008 is so troublesome, can someone please help me?
I followed a video in youtube, and for future, I type the action into a text file, here it is:
1) Copy the contents of E:\Raymond\game programming\allegro-msvc9-4.2.3\bin to C:\Program Files\Microsoft Visual Studio 9.0\VC\bin .
2) Copy the contents of E:\Raymond\game programming\allegro-msvc9-4.2.3\include to C:\Program Files\Microsoft Visual Studio 9.0\VC\include .
3) Copy the contents of E:\Raymond\game programming\allegro-msvc9-4.2.3\lib to C:\Program Files\Microsoft Visual Studio 9.0\VC\lib .
4) Copy the contents of E:\Raymond\game programming\allegro-msvc9-4.2.3\bin to C:\WINDOWS\system32
Then we open VS2008. This what the author of the video do:
5) Open VS2008, create a new Win32 project ( not console ). Select empty project.
6) Add a main.cpp in source folder.
7) On the Tabs, Click "Project" then click [Project name] property.
8) Choose "Configuration Property" and expand it.
9) Choose "Linker" and expland it. Click "Input".
10) Click Additional Dependencies, Add "alld.lib". Click OK.
alld.lib
alleg.lib
alld_s.lib
alleg_s.lib
alleg_s_crt.lib
allp.lib
allp_s.lib11) In main.cpp, write:
#include <allegro.h>
int main()
{
allegro_init();
set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);
install_keyboard();
textout_ex(screen, font, "Welcome to allegro!", 0,0, makecol(0, 0, 255), makecol(255,0,0));
readkey();
return 0;}
END_OF_MAIN();
When I ran it, it got errors:
1>------ Build started: Project: win32_allegro1, Configuration: Debug Win32 ------
1>Linking...
1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
1>C:\Documents and Settings\Raymond.Yeung\Desktop\GUI\win32_allegro1\Debug\win32_allegro1.exe : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://c:\Documents and Settings\Raymond.Yeung\Desktop\GUI\win32_allegro1\win32_allegro1\Debug\BuildLog.htm"
1>win32_allegro1 - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Then I think it would be a console project if we use int main(),
so I repeat 5) to 11), and make it a win32 console project.
5) Open VS2008, create a new Win32 console project. Select empty project.
Then I ran it again, it still goes error
1>------ Build started: Project: console_allegro1, Configuration: Debug Win32 ------
1>Linking...
1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
1>C:\Documents and Settings\Raymond.Yeung\Desktop\GUI\console_allegro1\Debug\console_allegro1.exe : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://c:\Documents and Settings\Raymond.Yeung\Desktop\GUI\console_allegro1\console_allegro1\Debug\BuildLog.htm"
1>console_allegro1 - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I search up the internet about "_main referenced in function ___tmainCRTStartup",
and one of the post suggest adding "#define ALLEGRO_USE_CONSOLE" on the top of main.cpp, so I followed.
#define ALLEGRO_USE_CONSOLE
#include <allegro.h>
int main()
{
allegro_init();
set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);
install_keyboard();
textout_ex(screen, font, "Welcome to allegro!", 0,0, makecol(0, 0, 255), makecol(255,0,0));
readkey();
return 0;
}
END_OF_MAIN();
Then I ran it again and there are no more error, it gave me 2 windows,
one is the console windows, another is a windows with text saying "Welcome to allegro!".
Here is the question: How can we remove the console windows??