Versions used : allegro 4.4.1.1, cmake2.8.1
I have the directX SDK installed in a seperate folder and do
set DirectXDir=I:\coding\src\directX
set INCLUDE=%DirectXDir%\INCLUDE;%INCLUDE%
set LIB=%DirectXDir%\LIB;%LIB%
before calling cmake.
MSVC9 problem :
If I do
cmake -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 9 2008" ..
with path to directX include/libs set, I still get a MSVC9 linker error that ddraw.lib was not found.
The problem seems to be related to the allegro CMakeLists.txt file
-- Windows --
if(WIN32)
# We should probably check for ddraw as well.
find_package(DInput)
find_package(DSound)
find_package(DXGuid)
Obviously the creator was aware of the problem but not 100% sure to include ddraw as well ?
If I add find_package(DDraw) and a handish tweaked FindDDraw.cmake, ddraw.lib will be located.
MSVC6 problem :
The project file created with cmake is trying to link the executables with /subsystem:console instead /subsystem:windows which will obviously fail.
Can these problems be fixed for a next 4.4 release ?
Allegro 4.4 never worked for me, it seems developers doesn't care about this version at all, I would suggest to use Allegro 4.2.3 + AllegroGL 0.4.3, instead.
allegro 4.4 works fine for me now but not out of the box. I had to fix some broken stuff like the missing cmake check for ddraw.
Ok! I'll give it a try again, this time with 4.4.1!
After running CMake I got this:
I am only interested in Allegro and AGL so I did not install the other addons, is that OK?
Once I obtained the ALLEGRO.sln, just double clicked it and started to build the project, then I got the following erros:
Just in case, I installed DirectX SDK (august 2009) and using VS 2008, also created the INCLUDE and LIB enviroment variables pointing to my include and lib VS directories, oh I installed the dx70_min.zip too.
What's wrong this time? Hate to say I am clueless about these problems!
I am only interested in Allegro and AGL so I did not install the other addons, is that OK?
Thats fine.
What's wrong this time?
Remember to add END_OF_MAIN() after your main function? If you remembered that, did you link to alleg_unsharable (if that lib is used on windows, not sure if it is)?
Paul: Maybe just try to read the error message. Do you really care about setup.exe, vesainfo.exe and co.?
Ok, I got these .libs files successfully created:
alleg44-debug.lib
alleg-debug-static.lib
alleg44.lib
alleg-profile-static.lib
alleg.lib
For some reason, I couldn't get the release statically-linked version, this is what I did:
$ cmake -DCMAKE_BUILD_TYPE=Release
$ cmake -DSHARED=off
Anyways, I created a new project using excamera.c file to test if I can compile it, and this is what happened:
I went to tools/Options/VC++ directiories and in Library files I added the path pointing to where my Allegro/release .libs files are, is that Ok?
Then, I clicked Project/Test properties/Linker/Command Line and in additional options I added alleg.lib, build the applications and this is what I got:
Looks like you're not linking to Allegro...
What's the proper way to link to allegro?
I just clicked in Project/Test properties/Linker/Command Line and in additional options I added alleg.lib, not sure if this is the proper way to link to allegro?
I don't know, I've never used anything newer than Allegro 4.2, but the manual or the wiki should have that info.
I don't really know what else I can do, I followed the instructions, I tried several times, I am asking for help in the forums, am I the only guy using 4.4?
WTF is wrong? not sure if is a problem in my .libs, or a problem in my VS configuration, I really feel frustrated, I see some effort in order to make this release a good choice, but it's driving me crazy.
This is how my face looks every time I try to compile using the Allegro 4.4 release:
{"name":"angrysparta.jpg","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/0\/a\/0a5882f34c84dbd9302ef858013eb09d.jpg","w":500,"h":319,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/0\/a\/0a5882f34c84dbd9302ef858013eb09d"}
It's in Project properties->Linker->Input. There should be a field named additional dependencies. There you put alleg.lib and all libs you use.
Check that the name of the library is actually alleg.lib (physically, on disk), it may have been renamed to allegro.lib (or maybe even something that includes a version number). I vaguely recall something to that effect for 4.4, but I have (indeed) never used it, certainly not on Windows, let alone on MSVC.
Then, I clicked Project/Test properties/Linker/Command Line and in additional options I added alleg.lib
Why? "alleg.lib" doesn't look like an option to me.
I tried Oscar suggestion but got same result.
alleg.lib is not a valid option? well here I am listing the .lib files I got after building the allegro.sln:
In Debug folder:
aldat.lib
alleg44-debug.lib
alleg-debug-static.lib
alleggl-debug.lib
jpgalleg-debug.lib.
In release folder:
aldat.lib
alleg.lib
alleggl.lib
jpgalleg.lib
I created an empty project from scratch, then I added the excamera.c (the AllegroGL one!) and started to try to build it using many different configurations: debug, release, etc, but I am allways getting linker errors.
I took a look at my Allegro 4.4.1 folder and I saw all the AllegroGL examples sucesfully created by the Allegro.sln, so now I am sure I have a VS configuration problem.
It seems the AGL examples were build using CMake, so probably the only way to start an AGL project from scratch and build it successfully is using CMake?
You just need to pass the libraries to your linker.
I copied allegro\addons\allegrogl\include files and folders to MSVC\vc\include, also copied allegro\lib\release\ *.lib files to MSVC\vc\lib.
Created a blank project, added excamera.c (AGL version), and linked like this:
{"name":"601619","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/c\/7\/c74f90ec4f3b9237ed406073da43ca8d.png","w":748,"h":520,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/c\/7\/c74f90ec4f3b9237ed406073da43ca8d"}
I am sure I am doing something wrong because I am getting these errors:
You also need to link against Allegro (alleg.lib or something) and OpenGL (opengl.lib).
Thanks Milan, I tried linking as you suggested:
{"name":"601621","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/7\/0\/70368ef475891af74edb1a986ff6a7ba.png","w":746,"h":518,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/7\/0\/70368ef475891af74edb1a986ff6a7ba"}
Since I couldn't find the file opengl.lib I had to link using opengl32.lib instead, is that ok?
Linking like that improved the situation, now I am getting fewer errors:
Do as I did when I needed to find the libs for various missing symbols: Google them. Just in your case, remove the __imp__ part when searching.
You need to link against all the libs as in allegro-4.2.
Thank you very much Thomas! following your advice I reduced the number of erros to only 7! Unfortunalely these remaining erros seems to be related to allegroGL, so I can't go futher.
Now I am linking with these librearies (in this order):
alleggl.lib alleg.lib opengl32.lib glu32.lib dsound.lib dxguid.lib winmm.lib ddraw.lib dinput.lib
These are the remaining errors (all of them related to allegrogl)
I think those are actually allegro functions. I can't recal if there's an "alleg-unsharable" lib on windows/MSVC, if there is, link to that as well.
There are not any "alleg-unsharable" library.
Anyways, after a lot of hard work I got the project working in Release and RelWithDebInfo modes (dynamically linking), however, I still can't build the project in debug mode.
These are the errors:
[EDIT ]
I got the project working in Debug (for some reason this only is posible in statically-linkg mode), so the quest is over!
THANKS TO ALL!