Hello sirs and madams.
I am having a bit of an issue with C::B and Allegro 5. As it stands right now, I can write and execute games with ease, but am unable to launch the game directly from the release and/or debug .exe files that are created upon building the application.
Upon building the application, a file is created under my bin/release directory, entitled "test.exe". Should I launch this file, I receive the following error message: "The procedure entry point __gx_personality_v0 could not be located in the dynamic link library libstdc++-6.dll."
In the past I have used Dev C++ as my primary IDE, and it has built Allegro 5 with ease; indeed, I would simply execute its game.exe file, and there you have it. This is not the case with C::B it seems. I am fairly new to C::B, so I am unfamiliar with its mannerisms. Any ideas?
Thank you in advance.
The IDE is only loosely related to your problem. In the future, refer to your compiler. And IDE is just a beefed up text editor.
Anyway, the problem is libstdc++-6.dll is needed to run your program because your program is dynamically linked to runtime libraries. This particular runtime library has all the code for the standard set of C++ libraries (strings, vectors, etc). You can solve your problem in one of four ways:
Copy libstdc++-6.dll from your compiler's directory (probably within the Code::Blocks directory, in this case, but no guarantees) into the same directory as you executable file.
Add the directory containing libstdc++-6.dll to your PATH environment variable. This will cause the new directory to automatically be searched for DLLs by executables.
Copy libstdc++-6.dll into your C:\Windows\system32 directory. This directory is automatically searched by executables for needed DLLs.
Statically link to the runtime library. I'm sure there is a setting for this in C::B somewhere.
The easiest method going forward is probably to statically link. It also means you wont have to distribute a DLL with your executable when giving it out to friends.
Thank you for your response. (My compiler is MinGW.)
I attempted to add the file to my system32 as well as the directory where my builds were being stored, but both returned the same error. Interestingly enough, both times also caused the error to occur whilst testing it in the IDE itself. As a result, I purged the files.
Thus leaving me with options 2 and 4 of your given advice. However, I am quite new to C::B and am unfamiliar with it, so I am unaware as to how that is done. Any advice?
I see, in that case the runtime libraries you are linking against are not the same as those used in the DLL.
Anyway, statically linking should still fix your problem. If you're using the latest MinGW compiler (based on gcc 4.7) you'll need to add the flags -static-libgcc and -static-libstdc++ to your compiler options.
Care that latest C::B uses GCC-TDM 4.7.1
It differs from vanilla GCC in exactly that, it defaults to linking statically libstdc++...usually throws an error if you pass the compiler flag -static-listdc++ as imentioned in Allegro5 wiki tutorial. (see you other thread).
which linker options are you passing to in C::B project?
Missing functions means mis-matched libraries. Wrong version of binaries for your version of mingw.
What does gcc -v say?
Which version of the binaries did you download?
pkrcel: Under "other linker options", I am passing the following...
`pkg-config --cflags --libs allegro allegro_acodec allegro_audio allegro_color allegro_dialog allegro_font allegro_image allegro_main allegro_memfile allegro_primitives allegro_ttf` `pkg-config libxml++-2.6 --cflags --libs` `pkg-config -static-libgcc -static-libstdc++`
Edgar Reynaldo: I believe I downloaded the newest versions. I have attached an image file of what gcc -v replies with.
They have to match your compiler exactly, or you will have problems. Why not just link to the static monolith? It would be much easier than using pkg-config and every single library. :/
I am a complete newbie here with linking files and whatnot.
How could I do that?
IDK if the mingw version 4.7.0 binaries for allegro will work with tdm 4.7.1. You might have to get a different compiler version, or compile allegro yourself.
There is a pre-built mingw 4.5.0 I put together here. (Which you can match with 4.5.0 allegro binaries)
http://sourceforge.net/p/unofficialmingw/
Just unzip it and set your paths and change your compiler in code blocks.
Edit
To link, use the -l flag followed directly by the name of the lib, without the leading lib or the ending .a
To link against libname.a, you would use -lname
pkrcel: Under "other linker options", I am passing the following...
`pkg-config --cflags --libs allegro allegro_acodec allegro_audio allegro_color allegro_dialog allegro_font allegro_image allegro_main allegro_memfile allegro_primitives allegro_ttf` `pkg-config libxml++-2.6 --cflags --libs` `pkg-config -static-libgcc -static-libstdc++`Edgar Reynaldo: I believe I downloaded the newest versions. I have attached an image file of what gcc -v replies with.
A little weird, since you are on windows, and the version of GCC you have is indeed TDM-GGC 4.7.1 (64bit) which comes bundled with latest C::B (since it is the one used to BUILD C::B itself, onlyit's 32bit)
Could you check the output of "pkg-config -static-libgcc -static-libstdc++" on your command line please?
Should I just type "pkg-config -static-libgcc -static-libstdc++" into my command line, or how should I go about this?
Yes, type it in.
Right click on the command line window for copy paste options.
Aah, okay. Thank you kindly.
The command line says it doesn't recognize it.
Yep, so the output is not passed to g++. As expected, I didn't know there was pkg-config for cmd.exe
Kidding aside, could you please make sure in the Compiler Settings -> Global Compiler Settings -> Other Settings Tab you have the Compiler Logging field set to "full command line". (Default in latest C::B)
Then please rebuld your project, and copy the content of the "output" window in a text file you attach here. I'll have a look at how the compiler is invoked.
Thanks
copy the content of the "output" window in a text file you attach here.
Better yet, look in your project directory and upload the build log for your project. It's named PROJECT_NAME_build_log.html.
Uh...doesn't it get appended for each and every build? I was afraid of a big file.
No, it overwrites the file each time.
Which makes a lot more sense...shame on me.
Hi everyone.
I have decided that, for the time being, I will no longer be using C::B, nor its environment.
Instead, I will now be attempting to compile and build my projects with the command line alone.
Should I ever return to this, and should I need assistance, I'll call.
Thank you for assisting me in the matter.
I already passed through building in command line, so I use my IDE and it just does everything all right. It also has neat GDB front-end, really convenient.