Jump to content
  • Advertisement
Sign in to follow this  
gameguysz

Allegro Problems With: VC++ 2008 and Dev-C++

This topic is 3343 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

Well i get this error when i try to compile in Visual Studios 2008.. 1>------ Build started: Project: Reborn Revise, Configuration: Debug Win32 ------ 1>Compiling... 1>Main.cpp 1>Linking... 1>Main.obj : error LNK2019: unresolved external symbol __imp__readkey referenced in function "int __cdecl _mangled_main(void)" (?_mangled_main@@YAHXZ) 1>Main.obj : error LNK2019: unresolved external symbol __imp__release_screen referenced in function "int __cdecl _mangled_main(void)" (?_mangled_main@@YAHXZ) 1>Main.obj : error LNK2019: unresolved external symbol __imp__acquire_screen referenced in function "int __cdecl _mangled_main(void)" (?_mangled_main@@YAHXZ) 1>Main.obj : error LNK2019: unresolved external symbol __imp__set_gfx_mode referenced in function "int __cdecl _mangled_main(void)" (?_mangled_main@@YAHXZ) 1>Main.obj : error LNK2019: unresolved external symbol __imp__install_keyboard referenced in function "int __cdecl _mangled_main(void)" (?_mangled_main@@YAHXZ) 1>Main.obj : error LNK2019: unresolved external symbol __imp___install_allegro_version_check referenced in function "int __cdecl _mangled_main(void)" (?_mangled_main@@YAHXZ) 1>Main.obj : error LNK2019: unresolved external symbol __imp___WinMain referenced in function _WinMain@16 1>MSVCRT.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup 1>C:\Users\Michael\Desktop\C++ games\Reborn Revise\Debug\Reborn Revise.exe : fatal error LNK1120: 8 unresolved externals 1>Build log was saved at "file://c:\Users\Michael\Desktop\C++ games\Reborn Revise\Reborn Revise\Debug\BuildLog.htm" 1>Reborn Revise - 9 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== Then i get this error in Dev-C++ Compiler: Default compiler Building Makefile: "C:\Users\Michael\Desktop\C++ games\DevC++\Makefile.win" Executing make... make.exe -f "C:\Users\Michael\Desktop\C++ games\DevC++\Makefile.win" all g++.exe main.o -o "Project1.exe" -L"C:/Dev-Cpp/lib" -mwindows main.o(.text+0x27):main.cpp: undefined reference to `_install_allegro_version_check' main.o(.text+0x2c):main.cpp: undefined reference to `install_keyboard' main.o(.text+0x58):main.cpp: undefined reference to `set_gfx_mode' main.o(.text+0x67):main.cpp: undefined reference to `readkey' main.o(.text+0x79):main.cpp: undefined reference to `_imp__screen' main.o(.text+0xb7):main.cpp: undefined reference to `_imp__screen' main.o(.text+0x118):main.cpp: undefined reference to `_WinMain' collect2: ld returned 1 exit status make.exe: *** [Project1.exe] Error 1 Execution terminated This is my code for both... #include <allegro.h> int main() { allegro_init(); install_keyboard(); set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0); acquire_screen(); release_screen(); readkey(); return 0; } END_OF_MAIN(); Someone please help me, i also have a problem trying to change the Dev-C++ options by pressing Alt-P, and it gives me this error: Access violation at address 0012F827. Write of address 0012F827 (at address 0x0012F827) Yes i have alot of problems... I thing Allegro is installed wrong but i have no clue what i am doing wrong but i have wen

Share this post


Link to post
Share on other sites
Advertisement
You need to link to alleg.lib. In VC++2008 you can add #pragma comment (lib, "alleg.lib") to your source file along with your includes, or add it in the Linker->Input Project settings.

Share this post


Link to post
Share on other sites
Quote:

i also have a problem trying to change the Dev-C++ options by pressing Alt-P, and it gives me this error:

Access violation at address 0012F827. Write of address 0012F827 (at address 0x0012F827)


[headshake] ...

Why you shouldn't use Dev-C++.

Adding to Erik's suggestion, you can find the Linker options (in Visual Studio) under the project properties; just press Alt+F7, or go to "Project->project Properties..." from the menu bar.

Share this post


Link to post
Share on other sites
i get 2 errors this time...

1>------ Build started: Project: Reborn Revise, Configuration: Debug Win32 ------
1>Compiling...
1>Main.cpp
1>Linking...
1>MSVCRT.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
1>C:\Users\Michael\Desktop\C++ games\Reborn Revise\Debug\Reborn Revise.exe : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://c:\Users\Michael\Desktop\C++ games\Reborn Revise\Reborn Revise\Debug\BuildLog.htm"
1>Reborn Revise - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


and this was because i added that line of code, so cool but i got to the linker input options but where do i add it and will it fix this error? because i was to get allegro working so i can start programming lol...


EDIT:
I got the linker to work lol but i am still getting the same 2 errors!


#include <allegro.h>


int main()
{
allegro_init();
install_keyboard();
set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0);

acquire_screen();

release_screen();

readkey();
return 0;
}
END_OF_MAIN();

Share this post


Link to post
Share on other sites
It seems you have created a console project. You need to either create a Windows project, or use #define ALLEGRO_USE_CONSOLE before including allegro.h, if you want a console window.
I would also recommend using GFX_AUTODETECT_WINDOWED for set_gfx_mode, so you don't have to switch screen resolutions every time you run it.

Share this post


Link to post
Share on other sites
OMFG THANK YOU! lol just like to say thanks to everyone here at this site for the quick response's and for sticking by my side ^_^ i almost cried lol jking but still thanks for the help guys hopefully when i get better at programming you will all see my name in a good game ^_^

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!