Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » C++, Visual 2008, Allegro 4.2.3, release mode compilation

This thread is locked; no one can reply to it. rss feed Print
C++, Visual 2008, Allegro 4.2.3, release mode compilation
qazcde
Member #15,472
January 2014

I wanted to compile my program the way I was able to execute it on any computer. Firstly, I changed the runtime library into multi-threaded to include dll libraries. Then I mentioned all the lib file names in additional dependecies. The program started to compile but there was information about a missing alld42.dll file. I copied it to release folder. After that there was a debug error: "This application has requested the Runtime to terminate it in an unusual way". Is there any way to compile in release mode succesfully?

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

You should upgrade to 4.4.3. The build system was totally redone to generate solutions with cmake. But to answer your question if it is asking to have alld42.dll then you are linking to a debugging version of allegro. You have to change your linker settings for your project in release mode. There were also numerous bug fixes and a few necessary fixes in the gfx_mode_select* dialogs.

#00JMP00
Member #14,740
November 2012

Is there a possibility to "include"/link the allegro42.dll in the exe-file when compiling?

If there is, how is it done??

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

#00JMP00 said:

Is there a possibility to "include"/link the allegro42.dll in the exe-file when compiling?

If there is, how is it done??

Every dll (dynamic link library) is associated with a *.a archived symbol library or in your case *.lib. That means you are linking to the wrong *.lib (ie, not the one associated with alleg42.dll. You link to a lib file and then run with a dll alongside your exe.

qazcde
Member #15,472
January 2014

Which of the lib files should be mentioned in linker settings? When I include any, the program compiles and runs, but when I click on the exe file, it crashes.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

qazcde
Member #15,472
January 2014

My binary distribution contains the following lib files: alld.lib, alld_s.lib, alleg.lib, alleg_s.lib, alleg_s_crt.lib, allp.lib, allp_s.lib.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

qazcde
Member #15,472
January 2014

Ok, I performed your tip in project properties. Now the program is compilable and it runs from the IDE, but the exe file still doesn't work.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

If you're running it from the IDE, your working directory might not be what you want it to be when the program runs, corrupting relative paths to files. That would make them fail to load. You can also make a debug build now, with alld.lib. If your program is crashing, you need to debug it. Post your code if that is the case.

#00JMP00
Member #14,740
November 2012

>Edgar Reynaldo:
>Okay he made profiling versions too.

>The one you want for release mode is alleg.lib. The _s is for static. The d is for >debug and the p is for profile.

What is the difference between alleg.lib and alleg_s.lib. In terms of executables, both of them should be static???

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

qazcde
Member #15,472
January 2014

Edgar Reynaldo, I'm not sure what the paths you meant (the library paths or my additional files paths) but you suggested me the right solution! It was a stupid mistake: there weren't files that I used additionally (music, images) in the main directory. What a pity the message box doesn't inform about such an error. Thank you very much for your indispensable help.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

qazcde said:

I'm not sure what the paths you meant (the library paths or my additional files paths) but you suggested me the right solution! It was a stupid mistake: there weren't files that I used additionally (music, images) in the main directory. What a pity the message box doesn't inform about such an error. Thank you very much for your indispensable help.

Welcome. The paths I was speaking of are the paths to your resources that you are loading in your code. You may find that you have all your resources in place, but it still doesn't load. If that happens the current working directory is most likely wrong, and you would have to change it with :

ALLEGRO_PATH* p = al_get_standard_path(ALLEGRO_RESOURCES_PATH);
if (!p) {Fail();}
al_change_directory(al_path_cstr(p , ALLEGRO_NATIVE_PATH_SEP));
al_destroy_path(p);

And the message box won't show up unless you code it to. ;)

Go to: