473,395 Members | 1,422 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Visual C++ 8.0 (2005) with the Allegro game library: Missing MSVCR80.dll?

PieCook
Error message: "The application has failed to start because MSVCR80.dll was not found. Re-installing the application may fix this problem."


Basically, I recently purchased a game programming book, and was trying to follow along. The book uses the Allegro game library, and I was trying to configure a Visual C++ 8.0 project to compile and link to the library.

First, I installed Allegro 4.2 by copying the lib and include folders to the Visual C++ installation folder, as well as the dll files in the bin folder to the System32 folder. I then created a test project, wrote a simple program to make sure the compiler is configured properly, and followed the instructions afterwards (Projects -> Properties -> Configuration Properties -> Linker -> Input -> Dependencies; type alleg.lib). But when I tried to run it, I got the message titled "Test 1.exe - Unable To Locate Component," which says, "The application has failed to start because MSVCR80.dll was not found. Re-installing the application may fix this problem." I tried to uninstall and re-install Visual C++, but kept getting the same error message.




Then, I was lucky enough to have found a link where you can download DLL files (dll-files.com). So, I downloaded the file msvcr80.dll and copied it in the same folder as the main cpp file, and got a runtime error this time:

"Runtime Error!

Program: c:\programming tests\test1\debug\Test 1.exe

R6034
An application has made an attempt to load the C runtime library incorrectly. Please contact the application's support team for more information.
"





Finally, I downloaded what I think is the runtime dll installer (they call it Microsoft Visual C++ 2005 Redistributable Package (x86)) from this link. (Can someone tell me if it's the correct link?) Because I deleted the dll file that I have manually copied, ran the runtime dll installer, but ended up with the original error message ("The application has failed to start because MSVCR80.dll was not found. Re-installing the application may fix this problem").



I tried to Google this problem, but wasn't able to find a solution. So far, I'm stuck in the configuration part, and cannot use the rest of the book until that's been taken care of. So if anyone knows how to fix this, I would greatly appreciate it.
Thank you.
Jul 19 '07 #1
3 6651
weaknessforcats
9,208 Expert Mod 8TB
When you add a library has been added as an additional linker dependency, that is for a static library rather than a dll.

With a dll, you have call LoadLibrary() to load the dll. Then call GetProcAddress() to get the address of the function inside the dll. This will be returned as a FARPROC. Next, delcare a function pointer with the correct arguments and return type and assign the FARPROC to it. Finally, call the function using the pointer. FreeLibrary() will unload it.

If other functions need this library, you need to call LoadLibrary() and pass the returned HMODULE to the other functions.
Jul 22 '07 #2
Thank you for your help, but I'm afraid none of these function calls worked. I probably typed them in the wrong place. However, I got it to work otherwise.

Here is my test program:

Expand|Select|Wrap|Line Numbers
  1. #include<allegro.h>
  2. int main(void)
  3. {
  4.     allegro_init();
  5.     set_gfx_mode(GFX_SAFE, 640, 480, 0, 0);
  6.     install_keyboard();
  7.     textout_ex(screen, font, "Hello World!", 1, 1, 10, -1);
  8.     textout_ex(screen, font, "Press ESCape to quit...", 1, 12, 11, -1);
  9.     while (!key[KEY_ESC]);
  10.     allegro_exit();
  11.     return 0;
  12. }
  13.  
  14. END_OF_MAIN()
  15.  
  16.  
When I added the LoadLibrary function, I got the following syntax error: "'LoadLibrary' undefined; assuming extern returning int." The same thing happened with all the other functions. I don't know where I'm supposed to insert those statements.



The way I got the program to compile was the following: After giving up on Visual Studio 8.0, I compiled the test program using Visual Studio 6.0 and it gave me no problems at all. Then, I went to the project folder and opened the file TestAllegro.dsw, a file of type VC++ 6 Workplace, and got the message, "The project 'TestAllegro.dsp' must be converted to the current Visual C++ project format. After it has been converted, you will not be able to edit this project in previous versions of Visual Studio. Convert and open this project?"

When I clicked "Yes," it opened the project in a VC++ 8.0 solution, and I was able to get it to work with that compiler.

By the way, I also downloaded and installed the files vcredist_x86.exe (Visual C++ runtime) and dotnetfx.exe (fix to the .NET 2.0 Framework) from the Microsoft website, and then installed the DirectX SDK from the CD-ROM. According to the book, the SDK was only needed for a static build, but I installed it anyway.


I hope Microsoft makes this easier in Visual Studio 2008.
Thanks again for your help.
Jul 24 '07 #3
weaknessforcats
9,208 Expert Mod 8TB
When I added the LoadLibrary function, I got the following syntax error: "'LoadLibrary' undefined; assuming extern returning int." The same thing happened with all the other functions. I don't know where I'm supposed to insert those statements.
LoadLibrary is declared in windows.h, which you didn't include. The code is in kernel32.lib which is a library added by default in both VC6.0 and VC 8.0.

Assume these functions are in ADLL.dll:
Expand|Select|Wrap|Line Numbers
  1.  
  2. void __stdcall DisplayFromDll()
  3. {
  4.     cout << "This function was called from ADLL.dll" << endl;
  5. }
  6.  
  7. int __stdcall AreaOfSquare (int len, int wid)
  8. {
  9.     return len * wid;
  10.  
The code should look like:

Expand|Select|Wrap|Line Numbers
  1. //First, load the dll into memory
  2. HMODULE theDll = LoadLibrary("C:\\Scratch\\ClassDemos\\ADll\\Debug\\ADll.dll");
  3.     if (!theDll)
  4.     {
  5.         cout << "The dll failed to load" << endl;
  6.         return 1;
  7.     }
  8.  
  9.     //Second, get the address of the desired function from the dll
  10.     FARPROC addr = GetProcAddress(theDll, "DisplayFromDll");
  11.     if (!addr)
  12.     {
  13.  
  14.         //Look up the error in the system errors list
  15.         unsigned int what = GetLastError();
  16.         if (what == ERROR_PROC_NOT_FOUND)
  17.         {
  18.             cout << "Function not found in the dll" << endl;
  19.         }
  20.         else
  21.         {
  22.             cout << "Error: " << what << endl;
  23.         }
  24.         return 2;
  25.     }
  26.     cout << "The function has been located in the dll" << endl;
  27.     //Declare a function pointer that can accept the address of the function.
  28.     //You will need to know the function prototype to do this.
  29.     //Dll function prototypes should be provided by the vendor of the dll
  30.     void (__stdcall *DisplayFromDll)();
  31.     //Type-cast the address returned from GetProcAddress to the function pointer type
  32.     DisplayFromDll = reinterpret_cast<void (__stdcall *)()>  (addr);
  33.     //Now use the function pointer to call the function:
  34.     DisplayFromDll();
  35.  
  36.     //If you don't use a .def file in the dll, you must use the mangled name
  37.     //Second, get the address of the desried function from the dll
  38.     addr = GetProcAddress(theDll, "AreaOfSquare");
  39.     if (!addr)
  40.     {
  41.  
  42.         //Look up the error in the system errors list
  43.         unsigned int what = GetLastError();
  44.         if (what == ERROR_PROC_NOT_FOUND)
  45.         {
  46.             cout << "Function not found in the dll" << endl;
  47.         }
  48.         else
  49.         {
  50.             cout << "Error: " << what << endl;
  51.         }
  52.         return 2;
  53.     }
  54.  
  55.     cout << "The function has been located in the dll" << endl;
  56.     //Declare a function pointer that can accept the address of the function.
  57.     //You will need to know the function prototype to do this.
  58.     //Dll function prototypes should be provided by the vendor of the dll
  59.     int (__stdcall *AreaOfSquare)(int, int);
  60.     //Type-cast the address returned from GetProcAddress to the function pointer type
  61.     AreaOfSquare = reinterpret_cast<int (__stdcall*)(int,int)>  (addr);
  62.     //Now use the function pointer to call the function:
  63.     cout << "The area of a 6x8 square is " << AreaOfSquare(6,8) << endl;;
  64.  
  65.     //Finally, unload the dll from memory
  66.     FreeLibrary(theDll);
  67.  
  68.     return 0;
  69. }
  70.  
Jul 24 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Karol | last post by:
I wonted to write programs with allegro library under Windows so I have downloaded Dev-c++, allegro library, mingw32 and dx70 for mingw. I configured allegro under mingw32 and installed Dev-c++. I...
18
by: Rob R. Ainscough | last post by:
MS Visual Studio Ad contained in VS Magazine. Two developers in "hip" clothing diagramming out a huge flow chart on a beach. I could NOT stop laughing at the stupidity of the ad -- "Let your...
2
by: AMD4me2 | last post by:
Each time I restart computer & run Norton System Works One Button Checkup, it finds same problems: missing program files: i.e.: ....NET\FRAMEWORK\v2.0...cannot access a necessary file,...
6
by: pkochanek | last post by:
Hi, my program is using both allegro.h and windows.h, but during compilling it i'm getting a lot of errors like "conflicts with previous declaration typedef struct BITMAP BITMAP". Problem is...
3
by: alexandre_irrthum | last post by:
Hi there, I am trying to install a Python library with a C extension (the Polygon library) and I am having a bad time. My Python version is Python 2.4.3 - Enthought Edition 1.0.0 (#69, Aug 2...
1
by: HugoScripts | last post by:
hi there, as i said i'm trying to compile a simple program that uses allegro, it's a small thing, indeed my goal was just to start using allegro, but until now i'm unable even to compile my simple...
10
by: Firecore | last post by:
Anyone here familiar with the allegro game library? I have some code that does not work: //This is a small test for allegro #include <allegro.h> #define WHITE makecol(255, 255, 255)
2
by: flingor | last post by:
I have written a little program with Microsoft's visual c++ and thus have an .exe of the program. Now I want to put this .exe in a separate folder for example to share it. What .dll do I have to...
4
by: silverleaf | last post by:
I'm starting to learn how to use the Allegro library with C++ on my own. My compiler is MSVisual C++ 6.0. The book I am learning out of is "Game Programming All In One, Third Edition" by Jonathan...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.