Compiling a GTK3 program in Visual Studio 2012

拜拜、爱过 提交于 2019-12-18 07:18:32

问题


With the release of Gtk 3 for windows I thought of upgrading my Gtk 2 C application to take advantage of the new GtkGrid widget.

The program compiles fine under linux or using MinGW (with codeblocks) under windows, however when I try the same set of files under Visual Studio 2012, giving me 50 or so compilation errors saying gutils.h, gtrashstack.h and gstring.h have a bunch of syntax errors (assuming I only use a basic program, with just a gtk_init and gtk_main).

Visual Studio handled gtk2 very well. Why is it refusing to compile with gtk3? Any way to get it to work with it? As much as I love Code::Blocks, external powers force me to keep my code VS2012-compatible...

EDIT: I created a repository with a simple gtk3 program and preconfigured project files for VS2012 and Codeblocks. https://github.com/The-J-Person/Example-gtk3-vs2012-project

EDIT 2: Here's a list of the compilation errors given by VS2012: http://pastebin.com/ThZpwVmg


回答1:


There is now an answer on the GTK mailing list.

In gutils.h lines 82 and 122, and in gstring.h line 129, change "static inline" to "static __inline". Alternatively add a PreprocessorDefinition to the project file to define "inline" as "__inline".

https://mail.gnome.org/archives/gtk-list/2014-January/msg00011.html

That allowed my project to work just fine.



来源:https://stackoverflow.com/questions/20883854/compiling-a-gtk3-program-in-visual-studio-2012

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!