Allegro & MSVC7

I'm having trouble even with simply getting the following code to work, so I'm sure I haven't set up something right.

1
2
3
4
5
6
7
8
9
10
11
12
13
// AllegroWin32ConsoleProject.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <allegro.h>


int main(){
    
    return 0;
    
}   
END_OF_MAIN(); 


If anyone is familiar with getting Allegro to work with MSVC7 I'd greatly appreciate some help. I've run "fix.bat msvc7" from the command prompt. I've added "...\allegro\include" to the Additional IncludeDirectories (I'm not even sure if I should have or not).

I get these errors:
AllegroWin32ConsoleProject error LNK2019: unresolved external symbol __imp___WinMain referenced in function _WinMain@16
AllegroWin32ConsoleProject error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup
AllegroWin32ConsoleProject fatal error LNK1120: 2 unresolved externals



Are you linking to the static libraries (*.lib)?
Project > Properties > Configuration Properties > C/C++ > General > Additional IncludeDirectories?

And for which confiugration (Active(debug), Debug, Release, All Configurations)?

(Can't be the above, won't let me choose *.lib, only directories, and this is what I tried before.)

And I'm not sure I built the libraries (I think I'm supposed to). I think I need a general n00b-programmer forum, this isn't strictly a C++ question.
Project > Properties > Configuration Properties > Linker > Input > Additional Dependencies
EDIT: Depending on how Allegro is built, you may need to add them to one or all configurations. Start by adding them to all.

Not sure if you need to build them. I never used Allegro. Maybe you do, maybe you don't.

Considering these are C/++ libraries, yes, this is a C++ question.
Last edited on
Aha, I was trying to do this from a Win32 Console Project, but I needed to do it with a Win32 Project. Now there is a Linker directory under Configuration Properties.
(Thanks to http://www.allegro.cc/docs/windows-msvc7-use.html)

I couldn't find the lib files or figure out how to make them so I decided to download the binaries instead of trying to compile and stuff that I don't understand. (http://www.allegro.cc/files/)

Then I was finally able to use this, once I had lib files:
http://www.allegro.cc/docs/windows-msvc7-use.html
I dynamically linked. I'm not sure what that means.

I made the empty project, followed the instructions, created main.cpp and input the following code:
1
2
3
4
5
6
7
8
9
#include <allegro.h>

int main(void)
{
  allegro_init();
  allegro_message("Hello World");
  return 0;
}
END_OF_MAIN();


Then compiled and ran but got the following error:

fatal error C1083: Cannot open include file: 'allegro.h': No such file or directory


...

then I copied the "include" directory from allegro to my "include" directory in MSVC7

that error gone, now a new one:

AllegroWin32Project fatal error LNK1104: cannot open file 'alld.lib'


probably the same issue

...

yep, copied "bin", "include", and "lib" from "allegro-msvc71-4.2.2" to ..."vc7"

all errors gone

compile and run...

AllegroWin32Project.exe - Unable To Locate Component
This application has failed to start becase alld42.dll was not found. Re-installing the application may fix this problem.

What now?... lol

Okay, so instead of copying "bin" dir to "vc7" i should have copied its contents to C:/windows/system32/

http://www.allegro.cc/forums/thread/592661

[center][sub][/center][tt][[/sub]u][i]S[/tt]UCC[/u]ESS[/i]!!!
It's not such a good idea to copy libs and stuff into the VC++ installation directory. It won't break anything, but when you start adding more libraries it'll get pretty messy. What I do is have a directory in My Documents called C++, where I have lib\ and include\. I dump everything there and modify the directory settings (tools > options > projects and solutions > VC++ directories).
It also makes things easier if you ever need to reinstall the IDE.

As for the run time error, you don't have the DLL in a place where the system can find it. You'll find it in the package you downloaded from the Allegro site. You can put it in c:\windows\system32 (may be different in your installation), or you can put it somewhere else and add the directory to your PATH environment variable, which is more practical when you need to reinstall Windows.
Topic archived. No new replies allowed.