2

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

Antonio
  • 155
  • 12
  • I think you need to include correct "Include directory" in project settings.. – Digital_Reality Jan 02 '14 at 13:17
  • I made sure of that. The errors are not regarding the compiler's inability to find a file - they claim there are syntax errors within gtk's header files, such as "expected { before const*". – Antonio Jan 02 '14 at 14:36
  • I added a to a repo demonstrating this. If anyone could get what's in there to compile under VS2012, that'd be the solution. – Antonio Jan 06 '14 at 16:44
  • Done. Edited to include link to error pastebin (I didn't add them to the post itself because it's rather long) – Antonio Jan 07 '14 at 08:16
  • Did you solve your problem. I am upgrading a GTK2 code to GKT3 and I'm sure my code is correct, but VS2010 doesn't compile GTK headers ! – joel76 Feb 11 '14 at 15:40

1 Answers1

2

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.

Christian Severin
  • 1,793
  • 19
  • 38
Antonio
  • 155
  • 12