Author Topic: GTKmm and Code::Blocks  (Read 12055 times)

Offline lpcstr

  • Multiple posting newcomer
  • *
  • Posts: 11
GTKmm and Code::Blocks
« on: February 01, 2011, 12:29:30 pm »
EDIT: Please refer to my later posts.

Ok, so I am unable to compile a simple GTKmm program:

Code
#include <gtkmm.h>

int main(int argc, char *argv[])
{
  Gtk::Main kit(argc, argv);
  Gtk::Window win;
  Gtk::Main::run(win);
  return 0;
}

Setup: Code::Blocks 10.05, MinGW - GCC 4.5.2, Windows 7 x64

I added `pkg-config gtkmm-2.4 --cflags --libs` to "other option", but when I compile I get this mess:

Code
C:\GTK\include\glibmm-2.4\glibmm\refptr.h|24|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Glib'|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cctype|66|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cctype|67|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cctype|68|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cctype|69|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cctype|70|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cctype|71|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cctype|72|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cctype|73|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cctype|74|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cctype|75|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cctype|76|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cctype|77|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cctype|78|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\GTK\include\glibmm-2.4\glibmm\unicode.h|51|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Glib'|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\bits\stringfwd.h|45|error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\bits\stringfwd.h|54|error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\bits\stringfwd.h|57|error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\bits\stringfwd.h|61|error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\bits\stringfwd.h|63|error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\bits\stringfwd.h|66|error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\bits\stringfwd.h|68|error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cstddef|51|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cstddef|52|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cwchar|67|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cwchar|141|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cwchar|143|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cwchar|144|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cwchar|145|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cwchar|146|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cwchar|147|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cwchar|148|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cwchar|149|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cwchar|150|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cwchar|151|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cwchar|152|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cwchar|153|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cwchar|154|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cwchar|155|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cwchar|156|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cwchar|157|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cwchar|158|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cwchar|162|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cwchar|163|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cwchar|164|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cwchar|166|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cwchar|172|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cwchar|174|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cwchar|176|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cwchar|178|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 0 warnings ===|

« Last Edit: February 01, 2011, 01:11:25 pm by lpcstr »

Offline lpcstr

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: GTKmm and Code::Blocks
« Reply #1 on: February 01, 2011, 12:39:29 pm »
Funny, I created a new project, with the same source code, and this time I get the following output:

Code
C:\GTK\include\gtk-2.0\gdk\gdkcairo.h|40|error: 'GdkPixbuf' does not name a type|
C:\GTK\include\gtk-2.0\gdk\gdkcairo.h|40|error: ISO C++ forbids declaration of 'pixbuf' with no type|
||=== Build finished: 2 errors, 0 warnings ===|

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline lpcstr

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: GTKmm and Code::Blocks
« Reply #3 on: February 01, 2011, 12:59:28 pm »
YET ANOTHER UPDATE

I looked at the copy of gdkpixbuf.h located in C:\GTK\include\gtk-2.0\gdk and the file was completely empty (what the hell.)

I downloaded gtk-2.0-dev and extracted a copy of the file that seems intact and replaced it. Now I'm getting undefined references, and have no idea what it means. Doing this in GNU/Linux is easy as pie, but trying to get anything to work (related to MinGW/GCC/C::B/Gnome) in Windows is a total nightmare.  :(

Code
obj\Debug\main.o||In function `main':|
C:\Users\NAME\Desktop\test\main.cpp|5|undefined reference to `Gtk::Main::Main(int&, char**&, bool)'|
C:\Users\NAME\Desktop\test\main.cpp|6|undefined reference to `Gtk::Window::Window(Gtk::WindowType)'|
C:\Users\NAME\Desktop\test\main.cpp|7|undefined reference to `Gtk::Main::run(Gtk::Window&)'|
C:\Users\NAME\Desktop\test\main.cpp|6|undefined reference to `Gtk::Window::~Window()'|
C:\Users\NAME\Desktop\test\main.cpp|5|undefined reference to `Gtk::Main::~Main()'|
C:\Users\NAME\Desktop\test\main.cpp|6|undefined reference to `Gtk::Window::~Window()'|
C:\Users\NAME\Desktop\test\main.cpp|5|undefined reference to `Gtk::Main::~Main()'|
obj\Debug\main.o||In function `_tcf_0':|
C:\GTK\include\gtkmm-2.4\gtkmm\papersize.h|41|undefined reference to `Glib::ustring::~ustring()'|
obj\Debug\main.o||In function `_tcf_1':|
C:\GTK\include\gtkmm-2.4\gtkmm\papersize.h|42|undefined reference to `Glib::ustring::~ustring()'|
obj\Debug\main.o||In function `_tcf_2':|
C:\GTK\include\gtkmm-2.4\gtkmm\papersize.h|43|undefined reference to `Glib::ustring::~ustring()'|
obj\Debug\main.o||In function `_tcf_3':|
C:\GTK\include\gtkmm-2.4\gtkmm\papersize.h|44|undefined reference to `Glib::ustring::~ustring()'|
obj\Debug\main.o||In function `_tcf_4':|
C:\GTK\include\gtkmm-2.4\gtkmm\papersize.h|45|undefined reference to `Glib::ustring::~ustring()'|
obj\Debug\main.o:C:\GTK\include\gtkmm-2.4\gtkmm\papersize.h|46|more undefined references to `Glib::ustring::~ustring()' follow|
obj\Debug\main.o||In function `_static_initialization_and_destruction_0':|
C:\GTK\include\gtkmm-2.4\gtkmm\papersize.h|41|undefined reference to `Glib::ustring::ustring(char const*)'|
C:\GTK\include\gtkmm-2.4\gtkmm\papersize.h|42|undefined reference to `Glib::ustring::ustring(char const*)'|
C:\GTK\include\gtkmm-2.4\gtkmm\papersize.h|43|undefined reference to `Glib::ustring::ustring(char const*)'|
C:\GTK\include\gtkmm-2.4\gtkmm\papersize.h|44|undefined reference to `Glib::ustring::ustring(char const*)'|
C:\GTK\include\gtkmm-2.4\gtkmm\papersize.h|45|undefined reference to `Glib::ustring::ustring(char const*)'|
obj\Debug\main.o:C:\GTK\include\gtkmm-2.4\gtkmm\papersize.h|46|more undefined references to `Glib::ustring::ustring(char const*)' follow|
||=== Build finished: 19 errors, 0 warnings ===|

« Last Edit: February 01, 2011, 01:12:30 pm by lpcstr »

Offline lpcstr

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: GTKmm and Code::Blocks
« Reply #4 on: February 01, 2011, 01:09:19 pm »
Read this: http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F

this is the build command being used, and as far as I can tell, it checks out.

Code
mingw32-g++.exe -Wall -fexceptions  -g  -mms-bitfields -IC:/GTK/include/gtkmm-2.4 -IC:/GTK/lib/gtkmm-2.4/include -IC:/GTK/include/atkmm-1.6 -IC:/GTK/include/giomm-2.4 -IC:/GTK/lib/giomm-2.4/include -IC:/GTK/include/pangomm-1.4 -IC:/GTK/lib/pangomm-1.4/include -IC:/GTK/include/gtk-2.0 -IC:/GTK/include/gdkmm-2.4 -IC:/GTK/lib/gdkmm-2.4/include -IC:/GTK/include/atk-1.0 -IC:/GTK/include/glibmm-2.4 -IC:/GTK/lib/glibmm-2.4/include -IC:/GTK/include/glib-2.0 -IC:/GTK/lib/glib-2.0/include -IC:/GTK/include/sigc++-2.0 -IC:/GTK/lib/sigc++-2.0/include -IC:/GTK/include/cairomm-1.0 -IC:/GTK/lib/cairomm-1.0/include -IC:/GTK/include/pango-1.0 -IC:/GTK/include/cairo -IC:/GTK/include -IC:/GTK/include/freetype2 -IC:/GTK/include/libpng14 -IC:/GTK/lib/gtk-2.0/include -IC:/GTK/include/gdk-pixbuf-2.0  -LC:/GTK/lib -Lc:/devel/dist/win32/libpng-1.4.3-1/lib -lgtkmm-2.4 -latkmm-1.6 -lgdkmm-2.4 -lgiomm-2.4 -lpangomm-1.4 -lgtk-win32-2.0 -lglibmm-2.4 -lcairomm-1.0 -lsigc-2.0 -lgdk-win32-2.0 -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lpng14 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl   -IC:\MinGW\include -IC:\MinGW\lib\gcc\mingw32\4.5.2\include -IC:\MinGW\lib\gcc\mingw32\4.5.2\include\c++ -IC:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\mingw32  -c C:\Users\NAME\Desktop\test\main.cpp -o obj\Debug\main.o
mingw32-g++.exe -LC:\MinGW\lib -LC:\MinGW\lib\gcc\mingw32\4.5.2  -o bin\Debug\test.exe obj\Debug\main.o

Edit: Ok, I found my mistake. I need to include the libs under LIBS/Other option, not compiler setting. That and the fact that the gtkmm-win32-devel-2.22.0-2 installer came with a defective source file were my issues.
« Last Edit: February 01, 2011, 01:19:06 pm by lpcstr »