I've been fighting for a month solid to build a //working// C++/gtkmm-3.0 application on Windows with MinGW. I finally managed to get the libraries, MinGW, and Codeblocks to get along on Windows XP (VirtualBox). However, when I try to build, I get the following errors.
These are the most recent versions of gtkmm-3.0 and dependencies. I got them via MSYS2, though I cannot build in that environment for reasons yet unknown. So, as is oft recommended, I copied them over to the MinGW /lib and /include directories, and ensured pkg-config could find them. All's well there (allegedly).
These problems are not originating from my code, obviously. I didn't write or modify gtkmm. Yet, I can't get these to go away.
It is worth mentioning that I was last getting errors relating to "cannot find glib::ustring::ustring", and it decided to stop whining about that and give me these out of the blue instead. If the earlier messages ever show up again, I'll post them here.
I'm beginning to think it isn't worth releasing this software on Windows at all.
NOTE: I am getting over 50 of these, all in gtkmm-3.0 and its dependency libraries, all originating from line 1 or 2 of main, and all with the exact same details. I'll show only a few in interest of space.
-------------- Build: Debug in infiltrator (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -std=c++11 -Wall -mms-bitfields -pthread -IC:/dev/MinGW/include/glibmm-2.4 -IC:/dev/MinGW/lib/glibmm-2.4/include -IC:/dev/MinGW/include/sigc++-2.0 -IC:/dev/MinGW/lib/sigc++-2.0/include -IC:/dev/MinGW/include/glib-2.0 -IC:/dev/MinGW/lib/glib-2.0/include -IC:/dev/MinGW/include/gtkmm-3.0 -IC:/dev/MinGW/lib/gtkmm-3.0/include -IC:/dev/MinGW/include/atkmm-1.6 -IC:/dev/MinGW/include/giomm-2.4 -IC:/dev/MinGW/lib/giomm-2.4/include -IC:/dev/MinGW/include/pangomm-1.4 -IC:/dev/MinGW/lib/pangomm-1.4/include -IC:/dev/MinGW/include/gtk-3.0 -IC:/dev/MinGW/include/cairomm-1.0 -IC:/dev/MinGW/lib/cairomm-1.0/include -IC:/dev/MinGW/include/gdk-pixbuf-2.0 -IC:/dev/MinGW/include/gdkmm-3.0 -IC:/dev/MinGW/lib/gdkmm-3.0/include -IC:/dev/MinGW/include/atk-1.0 -IC:/dev/MinGW/include/pango-1.0 -IC:/dev/MinGW/include/cairo -IC:/dev/MinGW/include/pixman-1 -IC:/dev/MinGW/include -I/mingw32/include/freetype2 -I/mingw32/include/libpng16 -I/mingw32/include/harfbuzz -I/mingw32/include/glib-2.0 -I/mingw32/lib/glib-2.0/include -I/mingw32/include -IC:/dev/MinGW/include/freetype2 -IC:/dev/MinGW/include/libpng16 -IC:/dev/MinGW/include/harfbuzz -Wl,-luuid -LC:/dev/MinGW/lib -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 -lgtk-3 -lglibmm-2.4 -lcairomm-1.0 -lgdk-3 -lgdi32 -limm32 -lshell32 -lole32 -lwinmm -lz -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lsigc-2.0 -lgobject-2.0 -lglib-2.0 -lintl -std=c++11 -Wall -g -mms-bitfields -pthread -IC:/dev/MinGW/include/glibmm-2.4 -IC:/dev/MinGW/lib/glibmm-2.4/include -IC:/dev/MinGW/include/sigc++-2.0 -IC:/dev/MinGW/lib/sigc++-2.0/include -IC:/dev/MinGW/include/glib-2.0 -IC:/dev/MinGW/lib/glib-2.0/include -IC:/dev/MinGW/include/gtkmm-3.0 -IC:/dev/MinGW/lib/gtkmm-3.0/include -IC:/dev/MinGW/include/atkmm-1.6 -IC:/dev/MinGW/include/giomm-2.4 -IC:/dev/MinGW/lib/giomm-2.4/include -IC:/dev/MinGW/include/pangomm-1.4 -IC:/dev/MinGW/lib/pangomm-1.4/include -IC:/dev/MinGW/include/gtk-3.0 -IC:/dev/MinGW/include/cairomm-1.0 -IC:/dev/MinGW/lib/cairomm-1.0/include -IC:/dev/MinGW/include/gdk-pixbuf-2.0 -IC:/dev/MinGW/include/gdkmm-3.0 -IC:/dev/MinGW/lib/gdkmm-3.0/include -IC:/dev/MinGW/include/atk-1.0 -IC:/dev/MinGW/include/pango-1.0 -IC:/dev/MinGW/include/cairo -IC:/dev/MinGW/include/pixman-1 -IC:/dev/MinGW/include -I/mingw32/include/freetype2 -I/mingw32/include/libpng16 -I/mingw32/include/harfbuzz -I/mingw32/include/glib-2.0 -I/mingw32/lib/glib-2.0/include -I/mingw32/include -IC:/dev/MinGW/include/freetype2 -IC:/dev/MinGW/include/libpng16 -IC:/dev/MinGW/include/harfbuzz -Wl,-luuid -LC:/dev/MinGW/lib -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 -lgtk-3 -lglibmm-2.4 -lcairomm-1.0 -lgdk-3 -lgdi32 -limm32 -lshell32 -lole32 -lwinmm -lz -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lsigc-2.0 -lgobject-2.0 -lglib-2.0 -lintl -std=c++11 -mms-bitfields -pthread -IC:/dev/MinGW/include/glibmm-2.4 -IC:/dev/MinGW/lib/glibmm-2.4/include -IC:/dev/MinGW/include/sigc++-2.0 -IC:/dev/MinGW/lib/sigc++-2.0/include -IC:/dev/MinGW/include/glib-2.0 -IC:/dev/MinGW/lib/glib-2.0/include -IC:/dev/MinGW/include/gtkmm-3.0 -IC:/dev/MinGW/lib/gtkmm-3.0/include -IC:/dev/MinGW/include/atkmm-1.6 -IC:/dev/MinGW/include/giomm-2.4 -IC:/dev/MinGW/lib/giomm-2.4/include -IC:/dev/MinGW/include/pangomm-1.4 -IC:/dev/MinGW/lib/pangomm-1.4/include -IC:/dev/MinGW/include/gtk-3.0 -IC:/dev/MinGW/include/cairomm-1.0 -IC:/dev/MinGW/lib/cairomm-1.0/include -IC:/dev/MinGW/include/gdk-pixbuf-2.0 -IC:/dev/MinGW/include/gdkmm-3.0 -IC:/dev/MinGW/lib/gdkmm-3.0/include -IC:/dev/MinGW/include/atk-1.0 -IC:/dev/MinGW/include/pango-1.0 -IC:/dev/MinGW/include/cairo -IC:/dev/MinGW/include/pixman-1 -IC:/dev/MinGW/include -I/mingw32/include/freetype2 -I/mingw32/include/libpng16 -I/mingw32/include/harfbuzz -I/mingw32/include/glib-2.0 -I/mingw32/lib/glib-2.0/include -I/mingw32/include -IC:/dev/MinGW/include/freetype2 -IC:/dev/MinGW/include/libpng16 -IC:/dev/MinGW/include/harfbuzz -Iinclude -IC:\dev\MinGW\include -c "C:\Documents and Settings\Jason\Desktop\infiltrator\main.cpp" -o obj\Debug\main.o
In file included from C:/dev/MinGW/include/pangomm-1.4/pangomm/fontset.h:33:0,
from C:/dev/MinGW/include/pangomm-1.4/pangomm/context.h:37,
from C:/dev/MinGW/include/gtkmm-3.0/gtkmm/widget.h:32,
from C:/dev/MinGW/include/gtkmm-3.0/gtkmm/actiongroup.h:29,
from C:/dev/MinGW/include/gtkmm-3.0/gtkmm/application.h:32,
from C:\Documents and Settings\Jason\Desktop\infiltrator\main.cpp:2:
C:/dev/MinGW/include/pangomm-1.4/pangomm/font.h:98:11: error: looser throw specifier for 'virtual Pango::Font::~Font()'
In file included from C:/dev/MinGW/include/glibmm-2.4/glibmm/binding.h:23:0,
from C:/dev/MinGW/include/glibmm-2.4/glibmm.h:96,
from C:\Documents and Settings\Jason\Desktop\infiltrator\main.cpp:1:
C:/dev/MinGW/include/glibmm-2.4/glibmm/object.h:117:11: error: overriding 'virtual Glib::Object::~Object() noexcept (true)'
In file included from C:/dev/MinGW/include/pangomm-1.4/pangomm/context.h:37:0,
from C:/dev/MinGW/include/gtkmm-3.0/gtkmm/widget.h:32,
from C:/dev/MinGW/include/gtkmm-3.0/gtkmm/actiongroup.h:29,
from C:/dev/MinGW/include/gtkmm-3.0/gtkmm/application.h:32,
from C:\Documents and Settings\Jason\Desktop\infiltrator\main.cpp:2:
C:/dev/MinGW/include/pangomm-1.4/pangomm/fontset.h:81:11: error: looser throw specifier for 'virtual Pango::Fontset::~Fontset()'
In file included from C:/dev/MinGW/include/glibmm-2.4/glibmm/binding.h:23:0,
from C:/dev/MinGW/include/glibmm-2.4/glibmm.h:96,
from C:\Documents and Settings\Jason\Desktop\infiltrator\main.cpp:1:
C:/dev/MinGW/include/glibmm-2.4/glibmm/object.h:117:11: error: overriding 'virtual Glib::Object::~Object() noexcept (true)'
In file included from C:/dev/MinGW/include/pangomm-1.4/pangomm/fontfamily.h:34:0,
from C:/dev/MinGW/include/pangomm-1.4/pangomm/fontmap.h:36,
from C:/dev/MinGW/include/pangomm-1.4/pangomm/context.h:38,
from C:/dev/MinGW/include/gtkmm-3.0/gtkmm/widget.h:32,
from C:/dev/MinGW/include/gtkmm-3.0/gtkmm/actiongroup.h:29,
from C:/dev/MinGW/include/gtkmm-3.0/gtkmm/application.h:32,
from C:\Documents and Settings\Jason\Desktop\infiltrator\main.cpp:2:
C:/dev/MinGW/include/pangomm-1.4/pangomm/fontface.h:81:11: error: looser throw specifier for 'virtual Pango::FontFace::~FontFace()'
In file included from C:/dev/MinGW/include/gtkmm-3.0/gtkmm/widget.h:41:0,
from C:/dev/MinGW/include/gtkmm-3.0/gtkmm/actiongroup.h:29,
from C:/dev/MinGW/include/gtkmm-3.0/gtkmm/application.h:32,
from C:\Documents and Settings\Jason\Desktop\infiltrator\main.cpp:2:
C:/dev/MinGW/include/gtkmm-3.0/gtkmm/buildable.h:107:11: error: looser throw specifier for 'virtual Gtk::Buildable::~Buildable()'
Process terminated with status 1 (0 minute(s), 6 second(s))
50 error(s), 0 warning(s) (0 minute(s), 6 second(s))
This type of error message seems to pop up with other stable, working projects and library being built on Windows, aside from gtkmm.
My best guess is that I forgot some compiler flag, setting, or other bright-blazingly obvious step in the build process. I will hasten to remind the reader that I am on CodeBlocks (13.14), so I didn't write that build command myself.
Requested Info
mingw32-g++.exe --version
mingw32-g++.exe (tdm-1) 4.7.1
This is the version that came bundled with CodeBlocks 13.14.
...
I will hasten to remind everyone that I didn't write any aspect of gtkmm or its dependencies, which is where all of these errors are originating. Also, this is a fully stable version, NOT a beta or development snapshot. Second, this exact same code is working with the exact same versions of the library on my Linux build.
That said, here are the complete lines of code from the requested locations.
C:/dev/MinGW/include/glibmm-2.4/glibmm/object.h, line 117
virtual ~Object() noexcept; //It should only be deleted by the callback.
C:/dev/MinGW/include/pangomm-1.4/pangomm/font.h, line 98
virtual ~Font();
Your g++ version is too old for this code: 4.7.x had a half-baked way
with the reconciliation of explicit and implied exception specifications
between inherited member functions, as in this case between the virtual
destructor of Glib::Object and that of Pango::Font.
You need to upgrade to at least GCC 4.8.1 - which happens to be
the latest stable version from MinGW. You can get well up-to-date
Windows port of GCC from TDM. Latest
there is 5.1
P.S. I am a little suspicious as to whether you have
builds of glibmm-2.4 and pangomm-1.4 that are really in sync. I have
the sources of these packages both official per my linux distro (Ubuntu 15.04), and the line numbers of the specimen problem declarations that I enquired about are different from yours and neither of them has a noexcept specification which certainly avoids the snag.
Related
I'm a beginning C++ programmer and want to use Code::Blocks IDE on Debian based Linux to write some GUI programs.
Therefore I would like to use gtkmm 3.0 with this code:
#include <gtkmm/gtkmm.h>
int main(int argc, char *argv[])
{
auto app = Gtk::Application::create(argc, argv, "org.gtkmm.examples.base");
Gtk::Window window;
window.set_default_size(200, 200);
return app->run(window);
}
The compiler gives me this error:
fatal error: gtkmm/gtkmm.h: No such file or directory
I followed these steps to install gtkmm:
Installed Code::Blocks and was able to compile non-GUI programs.
Then installed gtkmm-3.0 with synaptic.
In Code::Blocks settings > compiler > compiler settings > other compiler options I set:
pkg-config --cflags gtk+-3.0
In codeblock settings > compiler> linker settings > other linker settings I set:
pkg-config --libs gtk+-3.0
When compiling I got the next error in Build log:
Build file: "no target" in "no project" (compiler: unknown)
[ 50.0%] g++ -std=c++14 -pthread -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cairo -I/usr/include/libdrm -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -c /home/meltdown/Documents/C++/GTKmm2019C/t1/t1.cpp -o /home/meltdown/Documents/C++/GTKmm2019C/t1/t1.o
[100.0%] g++ -o /home/meltdown/Documents/C++/GTKmm2019C/t1/t1 /home/meltdown/Documents/C++/GTKmm2019C/t1/t1.o -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0
/home/meltdown/Documents/C++/GTKmm2019C/t1/t1.cpp:2:10: fatal error: gtkmm/gtkmm.h: No such file or directory
2 | #include <gtkmm/gtkmm.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))
1 error(s), 0 warning(s) (0 minute(s), 0 second(s))
I use a single .cpp file, not a Gtk+ project.
I've tried this and this but no luck. Does anyone know how to set up Code::Blocks and its compiler properly for gtkmm?
You've asked the IDE to search include directories for the GTK+ package with the command:
`pkg-config --cflags gtk+-3.0`
However, your program uses gtkmm, which is a layer on top of GTK+. You want to broaden the search to encompass the directories for gtkmm:
`pkg-config --cflags gtkmm-3.0`
(This replaces the current entry in the "other compiler options".) Similarly, you'll need to change, under "other linker settings", the library paths to:
`pkg-config --libs gtkmm-3.0`
I'm trying to install a C++ library (gtkmm) for my project and to test this installation with a simple test file (the main from wikipedia page about gtkmm).
I did brew install gtkmm3, it installed it but when I compile with clang++ -Wall -Werror -Wextra -o test test.cpp it doesn't find my header :
test.cpp:15:10: fatal error: 'gtkmm-3.0/gtkmm.h' file not found
#include <gtkmm-3.0/gtkmm.h>
The header is located at ~/homebrew/include/gtkmm-3.0/gtkmm.h.
I tried :
adding $HOME"/homebrew/include" to $PATH and using #include <gtkmm-3.0/gtkmm.h> in my source file.
adding $HOME"/homebrew/include/gtkmm-3.0" to my $PATH and using #include <gtkmm.h> in my source file.
But I still can't compile.
How could I do?
Yes, use pkgconfig like this and it will tell you all the include paths and the link paths you need:
pkg-config --libs --cflags /usr/local/Cellar/gtkmm3/*/lib/pkgconfig/gdkmm-3.0.pc
Output
-D_REENTRANT -I/usr/local/Cellar/gtkmm3/3.18.0/include/gdkmm-3.0
-I/usr/local/Cellar/gtkmm3/3.18.0/lib/gdkmm-3.0/include
-I/usr/local/Cellar/glibmm/2.46.3/include/giomm-2.4
-I/usr/local/Cellar/glibmm/2.46.3/lib/giomm-2.4/include
-I/usr/local/Cellar/pangomm/2.38.1/include/pangomm-1.4
-I/usr/local/Cellar/pangomm/2.38.1/lib/pangomm-1.4/include
-I/usr/local/Cellar/glibmm/2.46.3/include/glibmm-2.4
-I/usr/local/Cellar/glibmm/2.46.3/lib/glibmm-2.4/include
-I/usr/local/Cellar/gtk+3/3.18.6/include/gtk-3.0
-I/usr/local/Cellar/glib/2.46.2/include/gio-unix-2.0/
-I/usr/local/Cellar/cairo/1.14.6/include/cairo
-I/usr/local/Cellar/libepoxy/1.3.1/include
-I/usr/local/Cellar/pango/1.38.1/include/pango-1.0
-I/usr/local/Cellar/harfbuzz/1.1.3/include/harfbuzz
-I/usr/local/Cellar/pango/1.38.1/include/pango-1.0
-I/usr/local/Cellar/atk/2.18.0/include/atk-1.0
-I/usr/local/Cellar/cairo/1.14.6/include/cairo
-I/usr/local/Cellar/cairomm/1.12.0/include/cairomm-1.0
-I/usr/local/Cellar/cairomm/1.12.0/lib/cairomm-1.0/include
-I/usr/local/Cellar/cairo/1.14.6/include/cairo
-I/usr/local/Cellar/pixman/0.32.8/include/pixman-1
-I/usr/local/Cellar/fontconfig/2.11.1/include
-I/usr/local/Cellar/freetype/2.6_1/include/freetype2
-I/usr/local/Cellar/libpng/1.6.20/include/libpng16
-I/usr/local/Cellar/libsigc++/2.6.2/include/sigc++-2.0
-I/usr/local/Cellar/libsigc++/2.6.2/lib/sigc++-2.0/include
-I/usr/local/Cellar/gdk-pixbuf/2.32.3/include/gdk-pixbuf-2.0
-I/usr/local/Cellar/libpng/1.6.20/include/libpng16
-I/usr/local/Cellar/glib/2.46.2/include/glib-2.0
-I/usr/local/Cellar/glib/2.46.2/lib/glib-2.0/include
-I/usr/local/opt/gettext/include
-L/usr/local/Cellar/gtkmm3/3.18.0/lib
-L/usr/local/Cellar/glibmm/2.46.3/lib
-L/usr/local/Cellar/pangomm/2.38.1/lib
-L/usr/local/Cellar/glibmm/2.46.3/lib
-L/usr/local/Cellar/gtk+3/3.18.6/lib
-L/usr/local/Cellar/pango/1.38.1/lib
-L/usr/local/Cellar/atk/2.18.0/lib
-L/usr/local/Cellar/cairo/1.14.6/lib
-L/usr/local/Cellar/glib/2.46.2/lib
-L/usr/local/Cellar/cairomm/1.12.0/lib
-L/usr/local/Cellar/cairo/1.14.6/lib
-L/usr/local/Cellar/libsigc++/2.6.2/lib
-L/usr/local/Cellar/gdk-pixbuf/2.32.3/lib
-L/usr/local/Cellar/glib/2.46.2/lib
-L/usr/local/opt/gettext/lib
-lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 -lglibmm-2.4 -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lgio-2.0 -lcairomm-1.0 -lcairo -lsigc-2.0 -lgdk_pixbuf-2.0 -lgobject-2.0 -lglib-2.0 -lintl
Then you can compile with:
clang++ $(pkg-config --libs --cflags /usr/local/Cellar/gtkmm3/*/lib/pkgconfig/gdkmm-3.0.pc) someFile.cpp -o someFile
I have a project that I'm been fighting to build for Windows (XP) for a month solid now. The project uses gtkmm-3, C++, and the latest GCC-TDM compiler. My IDE is CodeBlocks 13.14.
I'm making progress, however, I am now getting hung up on this error message...
ld.exe cannot find -ldwmapi
Now, DWMAPI is a DLL only available on Windows Vista and above. According to my research, you can Delay Loading of certain DLLs in cases where they are present on some systems, but not on others.
The problem is, I have no clue how to do this on CodeBlocks. The -z lazy option does not accomplish this. If Delay Loading is impossible, how do I get around the dwmapi dependency. There has to be a way!
Full Build Command: (errors at bottom)
-------------- Clean: Debug in infiltrator (compiler: GNU GCC Compiler)---------------
Cleaned "infiltrator - Debug"
-------------- Build: Debug in infiltrator (compiler: GNU GCC Compiler)---------------
mingw32-g++-dw2.exe -std=c++11 -Wall -mms-bitfields -pthread -IC:/dev/MinGW/include/glibmm-2.4 -IC:/dev/MinGW/lib/glibmm-2.4/include -IC:/dev/MinGW/include/sigc++-2.0 -IC:/dev/MinGW/lib/sigc++-2.0/include -IC:/dev/MinGW/include/glib-2.0 -IC:/dev/MinGW/lib/glib-2.0/include -IC:/dev/MinGW/include/gtkmm-3.0 -IC:/dev/MinGW/lib/gtkmm-3.0/include -IC:/dev/MinGW/include/atkmm-1.6 -IC:/dev/MinGW/include/giomm-2.4 -IC:/dev/MinGW/lib/giomm-2.4/include -IC:/dev/MinGW/include/pangomm-1.4 -IC:/dev/MinGW/lib/pangomm-1.4/include -IC:/dev/MinGW/include/gtk-3.0 -IC:/dev/MinGW/include/cairomm-1.0 -IC:/dev/MinGW/lib/cairomm-1.0/include -IC:/dev/MinGW/include/gdk-pixbuf-2.0 -IC:/dev/MinGW/include/gdkmm-3.0 -IC:/dev/MinGW/lib/gdkmm-3.0/include -IC:/dev/MinGW/include/atk-1.0 -IC:/dev/MinGW/include/pango-1.0 -IC:/dev/MinGW/include/cairo -IC:/dev/MinGW/include/pixman-1 -IC:/dev/MinGW/include -I/mingw32/include/freetype2 -I/mingw32/include/libpng16 -I/mingw32/include/harfbuzz -I/mingw32/include/glib-2.0 -I/mingw32/lib/glib-2.0/include -I/mingw32/include -IC:/dev/MinGW/include/freetype2 -IC:/dev/MinGW/include/libpng16 -IC:/dev/MinGW/include/harfbuzz -Wl,-luuid -LC:/dev/MinGW/lib -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 -lgtk-3 -lglibmm-2.4 -lcairomm-1.0 -lgdk-3 -lgdi32 -limm32 -lshell32 -lole32 -lwinmm -ldwmapi -lz -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lsigc-2.0 -lgobject-2.0 -lglib-2.0 -lintl -std=c++11 -Wall -g -mms-bitfields -pthread -IC:/dev/MinGW/include/glibmm-2.4 -IC:/dev/MinGW/lib/glibmm-2.4/include -IC:/dev/MinGW/include/sigc++-2.0 -IC:/dev/MinGW/lib/sigc++-2.0/include -IC:/dev/MinGW/include/glib-2.0 -IC:/dev/MinGW/lib/glib-2.0/include -IC:/dev/MinGW/include/gtkmm-3.0 -IC:/dev/MinGW/lib/gtkmm-3.0/include -IC:/dev/MinGW/include/atkmm-1.6 -IC:/dev/MinGW/include/giomm-2.4 -IC:/dev/MinGW/lib/giomm-2.4/include -IC:/dev/MinGW/include/pangomm-1.4 -IC:/dev/MinGW/lib/pangomm-1.4/include -IC:/dev/MinGW/include/gtk-3.0 -IC:/dev/MinGW/include/cairomm-1.0 -IC:/dev/MinGW/lib/cairomm-1.0/include -IC:/dev/MinGW/include/gdk-pixbuf-2.0 -IC:/dev/MinGW/include/gdkmm-3.0 -IC:/dev/MinGW/lib/gdkmm-3.0/include -IC:/dev/MinGW/include/atk-1.0 -IC:/dev/MinGW/include/pango-1.0 -IC:/dev/MinGW/include/cairo -IC:/dev/MinGW/include/pixman-1 -IC:/dev/MinGW/include -I/mingw32/include/freetype2 -I/mingw32/include/libpng16 -I/mingw32/include/harfbuzz -I/mingw32/include/glib-2.0 -I/mingw32/lib/glib-2.0/include -I/mingw32/include -IC:/dev/MinGW/include/freetype2 -IC:/dev/MinGW/include/libpng16 -IC:/dev/MinGW/include/harfbuzz -Wl,-luuid -LC:/dev/MinGW/lib -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 -lgtk-3 -lglibmm-2.4 -lcairomm-1.0 -lgdk-3 -lgdi32 -limm32 -lshell32 -lole32 -lwinmm -ldwmapi -lz -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lsigc-2.0 -lgobject-2.0 -lglib-2.0 -lintl -z lazy -std=c++11 -mms-bitfields -pthread -IC:/dev/MinGW/include/glibmm-2.4 -IC:/dev/MinGW/lib/glibmm-2.4/include -IC:/dev/MinGW/include/sigc++-2.0 -IC:/dev/MinGW/lib/sigc++-2.0/include -IC:/dev/MinGW/include/glib-2.0 -IC:/dev/MinGW/lib/glib-2.0/include -IC:/dev/MinGW/include/gtkmm-3.0 -IC:/dev/MinGW/lib/gtkmm-3.0/include -IC:/dev/MinGW/include/atkmm-1.6 -IC:/dev/MinGW/include/giomm-2.4 -IC:/dev/MinGW/lib/giomm-2.4/include -IC:/dev/MinGW/include/pangomm-1.4 -IC:/dev/MinGW/lib/pangomm-1.4/include -IC:/dev/MinGW/include/gtk-3.0 -IC:/dev/MinGW/include/cairomm-1.0 -IC:/dev/MinGW/lib/cairomm-1.0/include -IC:/dev/MinGW/include/gdk-pixbuf-2.0 -IC:/dev/MinGW/include/gdkmm-3.0 -IC:/dev/MinGW/lib/gdkmm-3.0/include -IC:/dev/MinGW/include/atk-1.0 -IC:/dev/MinGW/include/pango-1.0 -IC:/dev/MinGW/include/cairo -IC:/dev/MinGW/include/pixman-1 -IC:/dev/MinGW/include -I/mingw32/include/freetype2 -I/mingw32/include/libpng16 -I/mingw32/include/harfbuzz -I/mingw32/include/glib-2.0 -I/mingw32/lib/glib-2.0/include -I/mingw32/include -IC:/dev/MinGW/include/freetype2 -IC:/dev/MinGW/include/libpng16 -IC:/dev/MinGW/include/harfbuzz -Iinclude -IC:\dev\MinGW\include -c "C:\Documents and Settings\Jason\Desktop\infiltrator\main.cpp" -o obj\Debug\main.o
mingw32-g++-dw2.exe -std=c++11 -Wall -mms-bitfields -pthread -IC:/dev/MinGW/include/glibmm-2.4 -IC:/dev/MinGW/lib/glibmm-2.4/include -IC:/dev/MinGW/include/sigc++-2.0 -IC:/dev/MinGW/lib/sigc++-2.0/include -IC:/dev/MinGW/include/glib-2.0 -IC:/dev/MinGW/lib/glib-2.0/include -IC:/dev/MinGW/include/gtkmm-3.0 -IC:/dev/MinGW/lib/gtkmm-3.0/include -IC:/dev/MinGW/include/atkmm-1.6 -IC:/dev/MinGW/include/giomm-2.4 -IC:/dev/MinGW/lib/giomm-2.4/include -IC:/dev/MinGW/include/pangomm-1.4 -IC:/dev/MinGW/lib/pangomm-1.4/include -IC:/dev/MinGW/include/gtk-3.0 -IC:/dev/MinGW/include/cairomm-1.0 -IC:/dev/MinGW/lib/cairomm-1.0/include -IC:/dev/MinGW/include/gdk-pixbuf-2.0 -IC:/dev/MinGW/include/gdkmm-3.0 -IC:/dev/MinGW/lib/gdkmm-3.0/include -IC:/dev/MinGW/include/atk-1.0 -IC:/dev/MinGW/include/pango-1.0 -IC:/dev/MinGW/include/cairo -IC:/dev/MinGW/include/pixman-1 -IC:/dev/MinGW/include -I/mingw32/include/freetype2 -I/mingw32/include/libpng16 -I/mingw32/include/harfbuzz -I/mingw32/include/glib-2.0 -I/mingw32/lib/glib-2.0/include -I/mingw32/include -IC:/dev/MinGW/include/freetype2 -IC:/dev/MinGW/include/libpng16 -IC:/dev/MinGW/include/harfbuzz -Wl,-luuid -LC:/dev/MinGW/lib -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 -lgtk-3 -lglibmm-2.4 -lcairomm-1.0 -lgdk-3 -lgdi32 -limm32 -lshell32 -lole32 -lwinmm -ldwmapi -lz -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lsigc-2.0 -lgobject-2.0 -lglib-2.0 -lintl -std=c++11 -Wall -g -mms-bitfields -pthread -IC:/dev/MinGW/include/glibmm-2.4 -IC:/dev/MinGW/lib/glibmm-2.4/include -IC:/dev/MinGW/include/sigc++-2.0 -IC:/dev/MinGW/lib/sigc++-2.0/include -IC:/dev/MinGW/include/glib-2.0 -IC:/dev/MinGW/lib/glib-2.0/include -IC:/dev/MinGW/include/gtkmm-3.0 -IC:/dev/MinGW/lib/gtkmm-3.0/include -IC:/dev/MinGW/include/atkmm-1.6 -IC:/dev/MinGW/include/giomm-2.4 -IC:/dev/MinGW/lib/giomm-2.4/include -IC:/dev/MinGW/include/pangomm-1.4 -IC:/dev/MinGW/lib/pangomm-1.4/include -IC:/dev/MinGW/include/gtk-3.0 -IC:/dev/MinGW/include/cairomm-1.0 -IC:/dev/MinGW/lib/cairomm-1.0/include -IC:/dev/MinGW/include/gdk-pixbuf-2.0 -IC:/dev/MinGW/include/gdkmm-3.0 -IC:/dev/MinGW/lib/gdkmm-3.0/include -IC:/dev/MinGW/include/atk-1.0 -IC:/dev/MinGW/include/pango-1.0 -IC:/dev/MinGW/include/cairo -IC:/dev/MinGW/include/pixman-1 -IC:/dev/MinGW/include -I/mingw32/include/freetype2 -I/mingw32/include/libpng16 -I/mingw32/include/harfbuzz -I/mingw32/include/glib-2.0 -I/mingw32/lib/glib-2.0/include -I/mingw32/include -IC:/dev/MinGW/include/freetype2 -IC:/dev/MinGW/include/libpng16 -IC:/dev/MinGW/include/harfbuzz -Wl,-luuid -LC:/dev/MinGW/lib -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 -lgtk-3 -lglibmm-2.4 -lcairomm-1.0 -lgdk-3 -lgdi32 -limm32 -lshell32 -lole32 -lwinmm -ldwmapi -lz -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lsigc-2.0 -lgobject-2.0 -lglib-2.0 -lintl -z lazy -std=c++11 -mms-bitfields -pthread -IC:/dev/MinGW/include/glibmm-2.4 -IC:/dev/MinGW/lib/glibmm-2.4/include -IC:/dev/MinGW/include/sigc++-2.0 -IC:/dev/MinGW/lib/sigc++-2.0/include -IC:/dev/MinGW/include/glib-2.0 -IC:/dev/MinGW/lib/glib-2.0/include -IC:/dev/MinGW/include/gtkmm-3.0 -IC:/dev/MinGW/lib/gtkmm-3.0/include -IC:/dev/MinGW/include/atkmm-1.6 -IC:/dev/MinGW/include/giomm-2.4 -IC:/dev/MinGW/lib/giomm-2.4/include -IC:/dev/MinGW/include/pangomm-1.4 -IC:/dev/MinGW/lib/pangomm-1.4/include -IC:/dev/MinGW/include/gtk-3.0 -IC:/dev/MinGW/include/cairomm-1.0 -IC:/dev/MinGW/lib/cairomm-1.0/include -IC:/dev/MinGW/include/gdk-pixbuf-2.0 -IC:/dev/MinGW/include/gdkmm-3.0 -IC:/dev/MinGW/lib/gdkmm-3.0/include -IC:/dev/MinGW/include/atk-1.0 -IC:/dev/MinGW/include/pango-1.0 -IC:/dev/MinGW/include/cairo -IC:/dev/MinGW/include/pixman-1 -IC:/dev/MinGW/include -I/mingw32/include/freetype2 -I/mingw32/include/libpng16 -I/mingw32/include/harfbuzz -I/mingw32/include/glib-2.0 -I/mingw32/lib/glib-2.0/include -I/mingw32/include -IC:/dev/MinGW/include/freetype2 -IC:/dev/MinGW/include/libpng16 -IC:/dev/MinGW/include/harfbuzz -Iinclude -IC:\dev\MinGW\include -c "C:\Documents and Settings\Jason\Desktop\infiltrator\src\agentDatabase.cpp" -o obj\Debug\src\agentDatabase.o
mingw32-g++-dw2.exe -LC:\dev\MinGW\lib -o bin\Debug\infiltrator.exe obj\Debug\main.o obj\Debug\src\agentDatabase.o obj\Debug\src\agentWindow.o obj\Debug\src\customWidgets.o obj\Debug\src\fileEncryption.o obj\Debug\src\gameWindow.o obj\Debug\src\infoWindow.o obj\Debug\src\keyGen.o obj\Debug\src\playerList.o obj\Debug\src\primaryWindow.o obj\Debug\src\setupWindow.o -Wl,-luuid -LC:/dev/MinGW/lib -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 -lgtk-3 -lglibmm-2.4 -lcairomm-1.0 -lgdk-3 -lgdi32 -limm32 -lshell32 -lole32 -lwinmm -ldwmapi -lz -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lsigc-2.0 -lgobject-2.0 -lglib-2.0 -lintl -Wl,-luuid -LC:/dev/MinGW/lib -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 -lgtk-3 -lglibmm-2.4 -lcairomm-1.0 -lgdk-3 -lgdi32 -limm32 -lshell32 -lole32 -lwinmm -ldwmapi -lz -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lsigc-2.0 -lgobject-2.0 -lglib-2.0 -lintl -Wl,-luuid -LC:/dev/MinGW/lib -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 -lgtk-3 -lglibmm-2.4 -lcairomm-1.0 -lgdk-3 -lgdi32 -limm32 -lshell32 -lole32 -lwinmm -ldwmapi -lz -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lsigc-2.0 -lgobject-2.0 -lglib-2.0 -lintl
C:/dev/MinGWOld/bin/../lib/gcc/mingw32/5.1.0-dw2/../../../../mingw32/bin/ld.exe: cannot find -ldwmapi
C:/dev/MinGWOld/bin/../lib/gcc/mingw32/5.1.0-dw2/../../../../mingw32/bin/ld.exe: cannot find -ldwmapi
C:/dev/MinGWOld/bin/../lib/gcc/mingw32/5.1.0-dw2/../../../../mingw32/bin/ld.exe: cannot find -ldwmapi
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (1 minute(s), 42 second(s))
3 error(s), 7 warning(s) (1 minute(s), 42 second(s))
Lazy linking, -z lazy, is the GNU linker's default on unix-like systems and
is not supported in the MinGW Windows ports. (This has nothing to do with
Code::Blocks)
I cannot fathom the hope that you repose in lazy linking to overcome
this problem, but it doesn't matter. If you can't count on some shared library
to be available on all target systems of your project one customary course
is to link the library statically in your executable. You can do that here.
The 32-bit TDM GCC that you are now using does not ship dwmapi in a static
library but the corresponding 64-bit toolchain does ship both 64- and 32-bit
builds of it, respectively:
<TDM-GCC-64-install-dir>/x86_64-w64-mingw32/lib/libdwmapi.a
and
<TDM-GCC-64-install-dir>/x86_64-w64-mingw32/lib32/libdwmapi.a
Those paths are among the linker defaults for the toolchain, so it
will link the library if you simply mention -ldwmapi in the linker options
(as you have done).
The absence of libdwmapi.a in the 32-bit toolchain may just be an anomaly, or
it may be a decision based on the fact that this library was not around until
Windows had transitioned to 64-bit in the mainstream.
You have 3 options then:
If you have no committment to building 32-bit you can swap to the
corresponding 64-bit toolchain (and 64-bit libraries accross the board)
Swap to the 64-bit toolchain but continue to build 32-bit by adding the
option -m32 for the compiler and linker
Install the 64-bit toolchain, continue using the 32-bit toolchain,
but add -L<TDM-GCC-64-install-dir>/x86_64-w64-mingw32/lib32 to your
linker search paths, after all those you have already specified.
A couple of unrelated observations:-
In this and your previous question all of
your g++ commandline options appear 3 times each! - yielding 4K commandlines that make
very tiresome parsing. With the Code::Blocks IDE, the only way in which you can have
produced this triplication is by setting all of these options once in the global
Settings -> Compiler, then again in the overall project settings infiltrator ->
Build options -> infiltrator, and yet again in the project Debug/Release configuration
settings infiltrator -> Build options -> infiltrator -> Debug/Release.
These 3 levels of settings form an inheritance hierarchy. Do not make any project
specific settings globally for any compiler. Doing so makes them properties of the
compiler and they will be applied to every other project that you build with
that compiler. Project settings that are invariant between project configurations
(Debug/Release) should be made only once at the project level. Debug and Release
options should be set only at the project configuration level.
Lastly I see that you have chosen to install the TDM-GCC-32 variant with Dwarf2
style exception handling, rather than the default package (per the executable
installer) with setjump-longjump style exception handling. This carries a risk.
While DW2 exception handling is significantly more efficient that SJLJ, it is
foreign to Windows and will fail if an exception must propagate through a Windows
library not built in the same way. The setjump-longjump mechamism, though slower,
relies on primtive, long standardized C library facilities that any
C or C++ compiler implements.
System: Windows7, 32 bit, GTK 2.24.10, mingw
I am trying to write basic helloworld.c type GTK based application. However, it doesn't run.
These are the steps which I followed.
Install MinGW.
Download GTK+ all in one bundle.
Extract content in C:\gtk folder.
Open cmd and go to C:\gtk\bin directory and run pkg-config --cflags --libs gtk+-win32-2.0
It prints list of compilation flags, and libraries to link your
project to.
Copy them and create a bath file as follows.
set VAR=FLAGS
start cmd
where VAR = GTK, and FLAGS = output of the previous command (pkg-config).
When you want to compile file use command : gcc foo.c %VAR%
D:\gtk>gcc -o project helloworld.c %GTK%
gcc: %GTK%: No such file or directory
helloworld.c:1:21: error: gtk/gtk.h: No such file or directory
helloworld.c: In function 'main':
helloworld.c:5: error: 'GtkWidget' undeclared (first use in this function)
helloworld.c:5: error: (Each undeclared identifier is reported only once
helloworld.c:5: error: for each function it appears in.)
helloworld.c:5: error: 'window' undeclared (first use in this function)
helloworld.c:9: error: 'GTK_WINDOW_TOPLEVEL' undeclared (first use in this function)
D:\gtk>gcc -Wall -g helloworld.c -o helloworld pkg-config --cflags gtk+-2.0 pkg-config --libs gtk+-2.0
gcc: pkg-config: No such file or directory
gcc: gtk+-2.0: No such file or directory
gcc: pkg-config: No such file or directory
gcc: gtk+-2.0: No such file or directory
cc1.exe: error: unrecognized command line option "-fcflags"
cc1.exe: error: unrecognized command line option "-flibs"
batch file in D:\gtk
set GTK=-mms-bitfields -IC:/gtk/include/gtk-2.0 -IC:/gtk/lib/gtk-2.0/include -IC:/gtk/include/atk-1.0 -IC:/gtk/include/cairo -IC:/gtk/include/gdk-pixbuf-2.0 -IC:/gtk/include/pango-1.0 -IC:/gtk/include/glib-2.0 -IC:/gtk/lib/glib-2.0/include -IC:/gtk/include -IC:/gtk/include/freetype2 -IC:/gtk/include/libpng14 -LC:/gtk/lib -lgtk-win32-2.0 -lgdk-win32-2.0 -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl
start cmd
helloworld.c
#include <gtk/gtk.h>
int main( int argc,
char *argv[] )
{
GtkWidget *window;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_show (window);
gtk_main ();
return 0;
}
Reference : Installing gtk and compiling using gcc under windows?
You could try these manual steps to start with:
1) At your command prompt run the pkg-config command to get your include flags:
c:\dev\gtk224\bin\pkg-config.exe --cflags gtk+-2.0
This is my output:
-mms-bitfields -Ic:/dev/gtk224/include/gtk-2.0 -Ic:/dev/gtk224/lib/gtk-2.0/include -Ic:/dev/gtk224/include/atk-1.0 -Ic:/dev/gtk224/include/cairo -Ic:/dev/gtk224/include/gdk-pixbuf-2.0 -Ic:/dev/gtk224/include/pango-1.0 -Ic:/dev/gtk224/include/glib-2.0 -Ic:/dev/gtk224/lib/glib-2.0/include -Ic:/dev/gtk224/include -Ic:/dev/gtk224/include/freetype2 -Ic:/dev/gtk224/include/libpng14
2) set the output from (1) to a variable GTK_INCLUDES:
C:\dev\1_repo\gtk_scratch>set GTK_INCLUDES=-mms-bitfields -Ic:/dev/gtk224/include/gtk-2.0 -Ic:/dev/gtk224/lib/gtk-2.0/include -Ic:/dev/gtk224/include/atk-1.0 -Ic:/dev/gtk224/include/cairo -Ic:/dev/gtk224/include/gdk-pixbuf-2.0 -Ic:/dev/gtk224/include/pango-1.0 -Ic:/dev/gtk224/include/glib-2.0 -Ic:/dev/gtk224/lib/glib-2.0/include -Ic:/dev/gtk224/include -Ic:/dev/gtk224/include/freetype2 -Ic:/dev/gtk224/include/libpng14
(make sure you use YOUR output from step (1))
3) do the same as step 1 for the library flags:
c:\dev\gtk224\bin\pkg-config.exe --libs gtk+-2.0
This is my output:
-Lc:/dev/gtk224/lib -lgtk-win32-2.0 -lgdk-win32-2.0 -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl
4) set output from (3) to a variable GTK_LIBS
C:\dev\1_repo\gtk_scratch>set GTK_LIBS=-Lc:/dev/gtk224/lib -lgtk-win32-2.0 -lgdk-win32-2.0 -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl
(make sure you use YOUR output from step (3))
5) make sure gtk+ and MinGW are on your path:
set PATH=c:\dev\MinGW\bin\;c:\dev\gtk224\bin
(make sure you set your path to YOUR mingw and gtk directories)
6) compile:
c:\dev\MinGW\bin\gcc.exe -g helloworld.c -o helloworld %GTK_INCLUDES% %GTK_LIBS%
7) when you are able to compile OK, copy what you did in steps 2,4,5 and 6 to a batch file so can compile you app just by running the batch file.
The error is right here.
pkg-config is a utility which helps (and I strongly recommend) to determine link and lib flags. The issue you got is that gcc interprets it as a parameter if you pass them like you do - you need to exectue them in a subshell (but I have no clue how to do that under windows shell or cygwin) under bash it is either $(pkconfig --libs gtk-2.0) or with backticks around instead of $(...)
D:\gtk>gcc -Wall -g helloworld.c -o helloworld pkg-config --cflags gtk+-2.0 pkg-config --libs gtk+-2.0
gcc: pkg-config: No such file or directory
gcc: gtk+-2.0: No such file or directory
gcc: pkg-config: No such file or directory
gcc: gtk+-2.0: No such file or directory
cc1.exe: error: unrecognized command line option "-fcflags"
cc1.exe: error: unrecognized command line option "-flibs"
Get same error when running hello, world program. Following solution work for me.
Instead of saving your helloworld.c at any arbitrary place, put it inside of
MinGW > msys > 1.0 > home > "Name of Your home folder" > helloworld.c
Now, open msys.bat and write the command to run program. In my case it was:
gcc hello.c -o hello `pkg-config --cflags --libs gtk+-3.0`
And it works for me!
OS: Windows 7
Compiler: MinGW
IDE: Code::Blocks
I just installed Gtkmm on my computer in the folder C:/gtkmm/ and set up an example program. When I compiled it, it gave the error "gtkmm.h: No such file or directory"
I tried setting the PATH variable to C:/gtkmm/include and C:/gtkmm/gtkmm-2.4, but neither worked. Then I tried using #include "C:/gtkmm/include/gtkmm-2.4/gtkmm.h" and that just gave a ton of errors saying that it doesn't know where a few dozen files are.
I've also heard that you need to put pkg-config gtkmm-2.4 --cflags --libs in the compiler options, but that didn't work either.
What am I doing wrong and how do I fix it?
pkg-config is a helper function for adding cflags and lib paths to the compiler line.
What you will need to do is add the libraries and cflags path to the compiler line. I am not 100% sure how to do that in code::blocks., though
In ubuntu 11.04, you need all these to compile even a simple gtkmm program:
Libs (pkg-config --libs gtkmm-2.4:
-pthread -lgtkmm-2.4 -latkmm-1.6 -lgdkmm-2.4 -lgiomm-2.4 -lpangomm-1.4 -lgtk-x11-2.0 -lglibmm-2.4 -lcairomm-1.0 -lsigc-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lm -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0
cflags paths (pkg-config --clfags gtkmm-2.4):
-I/usr/include/atk-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/gio-unix-2.0/ -I/usr/include/gtkmm-2.4 -I/usr/lib/gtkmm-2.4/include -I/usr/include/atkmm-1.6 -I/usr/include/giomm-2.4 -I/usr/lib/giomm-2.4/include -I/usr/include/pangomm-1.4 -I/usr/lib/pangomm-1.4/include -I/usr/include/gtk-2.0 -I/usr/include/gtk-unix-print-2.0 -I/usr/include/gdkmm-2.4 -I/usr/lib/gdkmm-2.4/include -I/usr/include/glibmm-2.4 -I/usr/lib/glibmm-2.4/include -I/usr/include/sigc++-2.0 -I/usr/lib/sigc++-2.0/include -I/usr/include/cairomm-1.0 -I/usr/lib/cairomm-1.0/include -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/lib/gtk-2.0/include -I/usr/include/gdk-pixbuf-2.0
Basically you would have to change every instance of /usr/include/ and /usr/lib/ to c:\path-to-library\
I am not sure how much of the above you need with MinGW, but with GCC on Linux, dropping any of them makes gtkmm programs not compile. Hope that at least puts you on the right path.
What do you mean with PATH variable? The global windows search PATH for executables? That would be wrong.
You need to look in your IDE for Include search path or header search path or something like that.
Does that pkg-config command work for you when you execute it on the command line? Such a pkg-config when used on a unix system is enclosed in backticks ` which causes it to be substituted by it's output. Don't know if your IDE can do that but if it works from the command line you have at least a list of all includes needed.
Use autotools C++ project. You need only edit two files configure.ac and Makefile.am.
Add this line to configure.ac
PKG_CHECK_MODULES([GTKMM], [gtkmm-3.0])
and these lines to Makefile.am
program_CPPFLAGS = $(GTKMM_CFLAGS)
program_LDADD = $(GTKMM_LIBS)