GNOME Bugzilla – Bug 543772
Unable to load from glade using gtkmm in MS Visual Studio 2008
Last modified: 2014-01-29 08:30:50 UTC
Please describe the problem: Hi, My simple gtkmm application fails to run in MS Visual Studio 2008 although it successfully compiles in the IDE (Have added the property sheets and tweaked the settings as described on the gtkmm documentation home page. Reason: The execution of the program fails when it encounters the following code snippet: Glib::RefPtr<Gnome::Glade::Xml> mainXml= Gnome::Glade::Xml::create(cars.glade); it produces the following error message: Glib::ConvertError at memory location 0x0023f52c console shows a warning: (Project CARS.exe:5000): libglade-WARNING **: could not find glade file '\xcc\xc c\xcc\xcccars.glade' Steps to reproduce: 1. Create any simple glade file 2. Create a gtkmm project and write a small program to load widgets from the glade file 3. Compile and run the program in Microsoft Visual Studio Actual results: Application crashes on execution Expected results: the application should have executed well because it was successfully compiled without errors Does this happen every time? Yes Other information:
Do you have this problem with the examples in the libglademm tarball?
(In reply to comment #1) > Do you have this problem with the examples in the libglademm tarball? > please could you tell me where the examples are located?
In the examples directory in the source tarball: http://ftp.gnome.org/pub/GNOME/sources/libglademm/2.6/
(In reply to comment #1) > Do you have this problem with the examples in the libglademm tarball? > By the way I tested the execution to run under MingW compiler in CodeBlocks and it runs without errors but fails under Visual Studio. I think the problem lies with the Visual C++'s comparability with libglademm libraries, otherwise why does it execute error-free under GNU-based compilers but not under Visual C++?
You can't mix compilers. Libraries are built for one specific compiler only, particularly in the case of C++ compilers. Where did you get this DLL from?
I got the GTKmm install package from the official GTKmm webpage. It includes a folder MSVC containing property sheets for Visual Studio 2005. On the official Gtkmm documentation page, there are instructions on configuring VS 2005 to compile and run Gtkmm apps on VS as well as on Dev-Cpp. I followed the instructions to the letter and was capable of compiling and running the Gtkmm-built C++ source codes under both compilers. However if I attempted to load glade files from within VS Studio, I got the errors as described in my initial bug report, whereas under Dev-Cpp or CodeBlocks, I faced no problem. Unless there are different versions of libglademm for the two compilers, which I am not aware of, I still find a reason to be confused why I cannot run a program that uses glade files in Visual Studio but runs glitch-free under Dev-Cpp or Code-Blocks. More confusing is that if glade files are not used, the program compiles and runs under both IDEs. Since VS produced the root this code snippet line: Glib::RefPtr<Gnome::Glade::Xml> mainXml= Gnome::Glade::Xml::create(cars.glade); I believe the resolution of the path to the glade resource file(cars.glade) by VS could be the source of the problem as it reports the path not found as "\xcc\xcc\xcc\xcccars.glade" Perhaps there is no actual conversion of the path from ASCII to the Unicode by VS when resolving the path and hence it compiles but fails to run because the path string is invalid. Thanks
> Unless there are different versions of libglademm for the two compilers, which > I am not aware of, I think there must be. g++ and MSVC++ are definitely not ABI compatible. I also guess that there must be multiple versions of each MSVC++ DLL for MT and non-MT, and for the two different MSVC++ memory models. > I still find a reason to be confused why I cannot run a program that uses > glade files in Visual Studio but runs glitch-free under > Dev-Cpp or Code-Blocks. Presumably Dev-Cpp and Code-Blocks are using g++. > More confusing is that if glade files are not used, the program compiles and runs under both IDEs. This might be just luck, though it does seem strange. Unfortunately, the win32 stuff does not seem well supported right now. Cedric Gustin is trying to hand over maintainership of that to some other people, properly documenting what the win32 install package should provide, among other things. Sorry, I'm not using Windows on a daily basis myself.
CCing Armin so we can resolve this issue and eventually close this bug report.
I have tried loading glade files with both MSVC++ and MinGW when I created the Windows binaries, and it worked for both. Emmanuel, is this problem still present with the binaries from a recent (gtkmm 2.14) Windows installer?
Emmanuel, please respond.
Sorry for the late reply... I have not yet tried the latest installer binaries (gtkmm 2.14). I had the problem with the gtkmm 2.10.11 installer binaries. For the time being I have been using the MingW compiler. I guess changes have been made and the problem has been solved. Anyway, I will check the binaries and inform you if I still faced the problems. Thanks,
Please do check.
Since at least 4 years, libglademm is deprecated in favor of Gtk::Builder. Are there any problems reading glade files with Gtk::Builder? Unless there are, this bug is obsolete.