Jump to content
  • Advertisement
Sign in to follow this  
World69star

HELP! Switching to C++ and visual studio using Allegro

This topic is 3854 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I just got visual studio 2005 prof free from college. I come from a 2 year java history using mainly netbeans, eclipse and command line compiler. I used to dabble in C++ but i always used dev++ or whatever it was called. 1. I installed the rather large platform sdk... I read this is neccessary for win32 applications, is that really the neccessary? as it uses a lot of space! Doesn't Visual studio 2005 prof come with all the header files etc.. you need for win32? If I don't need it is it ok to unistall it? 2. I installed the allegro binaries and tried to build this test code from a tutorial, everything has been double checked: /code #include <allegro.h> int main(int argc, char*argv[]) { allegro_init(); //init allegro install_keyboard(); //init keyboard set_gfx_mode(GFX_AUTODETECT, 640,480,0,0); //sets graphics and screen res readkey(); //stall for input return 0; //return main } END_OF_MAIN() //Allegro specific code for every program must be called after main code/ these are the errors I get: 1>------ Build started: Project: AllegroTest, Configuration: Debug Win32 ------ 1>Compiling... 1>Test1.cpp 1>c:\program files\microsoft visual studio 8\vc\include\allegro\internal\alconfig.h(397) : warning C4312: 'type cast' : conversion from 'unsigned int' to 'unsigned char *' of greater size 1>c:\program files\microsoft visual studio 8\vc\include\allegro\internal\alconfig.h(404) : warning C4312: 'type cast' : conversion from 'unsigned int' to 'unsigned char *' of greater size 1>c:\program files\microsoft visual studio 8\vc\include\allegro\inline\draw.inl(421) : warning C4312: 'type cast' : conversion from 'unsigned int' to 'unsigned char *' of greater size 1>c:\program files\microsoft visual studio 8\vc\include\allegro\inline\draw.inl(435) : warning C4312: 'type cast' : conversion from 'unsigned int' to 'unsigned char *' of greater size 1>c:\program files\microsoft visual studio 8\vc\include\allegro\inline\draw.inl(446) : warning C4312: 'type cast' : conversion from 'unsigned int' to 'unsigned short *' of greater size 1>c:\program files\microsoft visual studio 8\vc\include\allegro\inline\draw.inl(460) : warning C4312: 'type cast' : conversion from 'unsigned int' to 'unsigned short *' of greater size 1>c:\program files\microsoft visual studio 8\vc\include\allegro\inline\draw.inl(471) : warning C4312: 'type cast' : conversion from 'unsigned int' to 'unsigned short *' of greater size 1>c:\program files\microsoft visual studio 8\vc\include\allegro\inline\draw.inl(485) : warning C4312: 'type cast' : conversion from 'unsigned int' to 'unsigned short *' of greater size 1>c:\program files\microsoft visual studio 8\vc\include\allegro\inline\draw.inl(521) : warning C4312: 'type cast' : conversion from 'unsigned int' to 'unsigned int *' of greater size 1>c:\program files\microsoft visual studio 8\vc\include\allegro\inline\draw.inl(535) : warning C4312: 'type cast' : conversion from 'unsigned int' to 'unsigned int *' of greater size 1>Compiling manifest to resources... 1>Linking... 1>Test1.obj : error LNK2019: unresolved external symbol __imp__readkey referenced in function "int __cdecl _mangled_main(int,char * * const)" (?_mangled_main@@YAHHQAPAD@Z) 1>Test1.obj : error LNK2019: unresolved external symbol __imp__set_gfx_mode referenced in function "int __cdecl _mangled_main(int,char * * const)" (?_mangled_main@@YAHHQAPAD@Z) 1>Test1.obj : error LNK2019: unresolved external symbol __imp__install_keyboard referenced in function "int __cdecl _mangled_main(int,char * * const)" (?_mangled_main@@YAHHQAPAD@Z) 1>Test1.obj : error LNK2019: unresolved external symbol __imp___install_allegro_version_check referenced in function "int __cdecl _mangled_main(int,char * * const)" (?_mangled_main@@YAHHQAPAD@Z) 1>Test1.obj : error LNK2019: unresolved external symbol __imp___WinMain referenced in function _WinMain@16 1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup 1>L:\C PLus Plus\VC8Projects\AllegroTest\AllegroTest\Debug\AllegroTest.exe : fatal error LNK1120: 6 unresolved externals 1>Build log was saved at "file://l:\C PLus Plus\VC8Projects\AllegroTest\AllegroTest\Debug\BuildLog.htm" 1>AllegroTest - 7 error(s), 10 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Share this post


Link to post
Share on other sites
Advertisement
1. Yes, it is necessary. You could go use some third party cross-platform library instead though, if you don't need direct access to the more intimate parts of Windows.

2. It looks like you didn't add the Allegro library files to your build configuration. (You have to explicitly tell the Visual Studio that you want to link against the Allegro libraries, not only include the required headers.) Unfortunately, I don't remember how to do this in Visual Studio. If memory serves though, you have to add liballeg32.lib (I think that was the name) to the list of linked libraries somewhere in the build settings dialogs.

Share this post


Link to post
Share on other sites
Those warnings look to me like Allegro is doing some casting between pointer types and unsigned ints. In 32-bit Windows this is "okay", since a pointer and an int are the same size. However in 64-bit pointers are 64-bit and ints are still 32-bit, so Visual Studio gives you a warning when "detect 64-bit portability issues" is enabled for the project.

As for the Platform SDK (which is now called the Windows SDK), 2005 Pro does come with it but it's a very old version. You'll want to use the latest version, as it will have the most up-to-date documentation and support for all the latest features in Windows Vista.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!