mettli / guichan

Automatically exported from code.google.com/p/guichan
Other
0 stars 0 forks source link

bad_alloc in version 0.8.2 #141

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Compiling *.lib files
2. Calling 'new gcn::Label("Hello World")'
3. ...or 'new gcn::ImageFont("...", "...")' for example

What is the expected behaviour? What happens instead?

I'm trying to use gcn 0.8.2 (opengl + sdl) in my vc2010, but I'm getting a 
std::bad_alloc exception each time my program trying to load font, create a 
button, etc. Until now I was using 0.6.1 for a few days and it worked well. 
Then I decided to migrate to 0.8.2, but have not found compiled 
guichan_opengl.lib and guichan_sdl.lib (other files I've got here: 
http://thejosh.info/guichan/guichan-0.8.2-devel-win32.zip). Of course, I tried 
to compile them by myself, but the size of them is about 3Mb... Anyway, that 
didn't work. I also tried to use libraries from version 0.6.1, but it didn't 
help me too. And everytime I have the same exception in the same lines of code.
Here's the code example (from helloworld.cpp):
gcn::ImageFont* font;
gcn::Label* label;

//The line below throws exception
font = new gcn::ImageFont("fixedfont.bmp", " 
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
gcn::Widget::setGlobalFont(font);
//Even if I delete font loading, the exception will throw here
label = new gcn::Label("Hello World");

What version of the product are you using? On what operating system? Which 
back-end (SDL/Allegro/OpenGL/other)?

0.8.2 (Opengl + SDL), Windows XP SP3 Professional, VC2010 (the same problem in 
VC2008)

Please provide any additional information below.

If you think that the problem is somewhere in libraries I built, could you 
please send me your *.lib files for 0.8.2 to a.insolite@gmail.com ?

Original issue reported on code.google.com by a.insol...@gmail.com on 8 Feb 2012 at 5:52

GoogleCodeExporter commented 9 years ago
Must be something strange about the way you build, or how the libraries (don't) 
fit together correctly... 

Usual recommendation is to include the guichan files into your project, which 
makes sure they are built the same way your project is built. It might be a 
problem due to inconsistent use of static/ dynamic runtime libraries, or dbg/ 
opt or whatever. 

Original comment by tobias.s...@gmx.net on 8 Feb 2012 at 6:02

GoogleCodeExporter commented 9 years ago
I've switched from 'Debug' to 'Release' and now it finally works! So problem 
was somewhere in debug options. I hope, I'll figure it out later. Thanks a lot! 
:)

Original comment by a.insol...@gmail.com on 8 Feb 2012 at 6:44

GoogleCodeExporter commented 9 years ago
In addition to the pointers Tobias gave, this kind of thing often happens when 
your include directories are pointing to a different version of the library 
than your linker settings. Guichan has not maintained binary compatibility 
between versions, so it's important to make sure those match up.

I'll change the status of the report to Invalid since fortunately Guichan 
doesn't randomly crash like that. :-)

Original comment by b.lindeijer on 8 Feb 2012 at 9:02