views:

239

answers:

2

Hello stackoverflow members, How can I use gtkmm with MinGW (g++) without MSYS? Here is the story of my problem: I installed MinGW offline with all required packages (full install). I installed Apache Server and I copied all .tar.gz files and I created a website called sourceforge.org [localhost] and I installed automatically MinGW on Windows XP. After, I set the PATH variables. After, I installed gtkmm for MinGW (g++). I tried to compile a simple window with gtkmm + MinGW, but it does not work. I use this command line: g++ simple.cc -o simple pkg-config gtkmm-2.4 --cflags --libs After, I installed MSYS and I can compile simple.cc with MSYS, using this command line: g++ simple.cc -o simple pkg-config gtkmm-2.4 --cflags --libs My problem: I want to compile simple.cc without MSYS. I want compile my simple.cc with cmd.exe - It's possbile? If, yes. How? Thank you for reading my message. Any help is appreciated.

A: 

Based on your command line, I'm guessing pkg-config is going to output a set of libraries and compile flags. If you can determine what the output will be for your machine, you can simply substitute that output in place of the command.

I've done something similar when working with SDL. It provides an sdl-config script that has a predictable output on my machine.

Kristo
A: 

base.cc source code:

#include <gtkmm.h>
int main(int argc, char *argv[])
{
Gtk::Main kit(argc, argv);
Gtk::Window window;
Gtk::Main::run(window);
return 0;
}

Command line:

pkg-config gtkmm-2.4 --cflags --libs

Result:

-mms-bitfields -IC:/gtkmm/include/gtkmm-2.4 -IC:/gtkmm/lib/gtkmm-2.4/include -IC:/gtkmm/include/giomm-2.4-IC:/gtkmm/lib/giomm-2.4/include -IC:/gtkmm/include/pangomm-1.4 -IC:/gtkmm/lib/pangomm-1.4/include -IC:/gtkmm/include/gtk-2.0 -IC:/gtkmm/include/atkmm-1.6 -IC:/gtkmm/include/gdkmm-2.4 -IC:/gtkmm/lib/gdkmm-2.4/include -IC:/gtkmm/include/glibmm-2.4 -IC:/gtkmm/lib/glibmm-2.4/include -IC:/gtkmm/include/glib-2.0 -IC:/gtkmm/lib/glib-2.0/include -IC:/gtkmm/include/sigc++-2.0 -IC:/gtkmm/lib/sigc++-2.0/include -IC:/gtkmm/include/cairomm-1.0 -IC:/gtkmm/lib/cairomm-1.0/include -IC:/gtkmm/include/pango-1.0 -IC:/gtkmm/include/cairo -IC:/gtkmm/include/freetype2 -IC:/gtkmm/include -IC:/gtkmm/include/libpng14 -IC:/gtkmm/lib/gtk-2.0/include -IC:/gtkmm/include/atk-1.0  -LC:/gtkmm/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 -lgdk_pixbuf-2.0 -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0-lgthread-2.0 -lglib-2.0 -lintl

Command line:

g++ base.cc -o base `pkg-config gtkmm-2.4 --cflags --libs`

Result:

g++: `pkg-config: No such file or directory
g++: gtkmm-2.4: No such file or directory
cc1plus.exe: error: unrecognized command line option "-fcflags"
cc1plus.exe: error: unrecognized command line option "-flibs`"

Command line:

g++ base.cc -o base -D_REENTRANT -IC:/gtkmm/include/gtkmm-2.4 -IC:/gtkmm/lib/gtkmm-2.4/include -IC:/gtkmm/include/giomm-2.4-IC:/gtkmm/lib/giomm-2.4/include -IC:/gtkmm/include/pangomm-1.4 -IC:/gtkmm/lib/pangomm-1.4/include -IC:/gtkmm/include/gtk-2.0 -IC:/gtkmm/include/atkmm-1.6 -IC:/gtkmm/include/gdkmm-2.4 -IC:/gtkmm/lib/gdkmm-2.4/include -IC:/gtkmm/include/glibmm-2.4 -IC:/gtkmm/lib/glibmm-2.4/include -IC:/gtkmm/include/glib-2.0 -IC:/gtkmm/lib/glib-2.0/include -IC:/gtkmm/include/sigc++-2.0 -IC:/gtkmm/lib/sigc++-2.0/include -IC:/gtkmm/include/cairomm-1.0 -IC:/gtkmm/lib/cairomm-1.0/include -IC:/gtkmm/include/pango-1.0 -IC:/gtkmm/include/cairo -IC:/gtkmm/include/freetype2 -IC:/gtkmm/include -IC:/gtkmm/include/libpng14 -IC:/gtkmm/lib/gtk-2.0/include -IC:/gtkmm/include/atk-1.0  -LC:/gtkmm/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 -lgdk_pixbuf-2.0 -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0-lgthread-2.0 -lglib-2.0 -lintl

Result: Many errors looks like:

C:/gtkmm/include/gtkmm-2.4/gtkmm/statusicon.h:269: error: ISO C++ forbids declar
ation of `get_icon' with no type
C:/gtkmm/include/gtkmm-2.4/gtkmm/statusicon.h:589: error: `Gio' has not been dec
lared
C:/gtkmm/include/gtkmm-2.4/gtkmm/statusicon.h:589: error: `Icon' was not declare
d in this scope
C:/gtkmm/include/gtkmm-2.4/gtkmm/statusicon.h:589: error: template argument 1 is
 invalid
C:/gtkmm/include/gtkmm-2.4/gtkmm/statusicon.h:589: error: template argument 1 is
 invalid
C:/gtkmm/include/gtkmm-2.4/gtkmm/statusicon.h:589: error: ISO C++ forbids declar
ation of `property_gicon' with no type
C:/gtkmm/include/gtkmm-2.4/gtkmm/statusicon.h:599: error: `Gio' has not been dec
lared
C:/gtkmm/include/gtkmm-2.4/gtkmm/statusicon.h:599: error: `Icon' was not declare
d in this scope
C:/gtkmm/include/gtkmm-2.4/gtkmm/statusicon.h:599: error: template argument 1 is
 invalid
C:/gtkmm/include/gtkmm-2.4/gtkmm/statusicon.h:599: error: template argument 1 is
 invalid
C:/gtkmm/include/gtkmm-2.4/gtkmm/statusicon.h:599: error: ISO C++ forbids declar
ation of `property_gicon' with no type

Command line:

g++ base.cc -o base -mms-bitfields -IC:/gtkmm/include/gtkmm-2.4 -IC:/gtkmm/lib/gtkmm-2.4/include -IC:/gtkmm/include/giomm-2.4-IC:/gtkmm/lib/giomm-2.4/include -IC:/gtkmm/include/pangomm-1.4 -IC:/gtkmm/lib/pangomm-1.4/include -IC:/gtkmm/include/gtk-2.0 -IC:/gtkmm/include/atkmm-1.6 -IC:/gtkmm/include/gdkmm-2.4 -IC:/gtkmm/lib/gdkmm-2.4/include -IC:/gtkmm/include/glibmm-2.4 -IC:/gtkmm/lib/glibmm-2.4/include -IC:/gtkmm/include/glib-2.0 -IC:/gtkmm/lib/glib-2.0/include -IC:/gtkmm/include/sigc++-2.0 -IC:/gtkmm/lib/sigc++-2.0/include -IC:/gtkmm/include/cairomm-1.0 -IC:/gtkmm/lib/cairomm-1.0/include -IC:/gtkmm/include/pango-1.0 -IC:/gtkmm/include/cairo -IC:/gtkmm/include/freetype2 -IC:/gtkmm/include -IC:/gtkmm/include/libpng14 -IC:/gtkmm/lib/gtk-2.0/include -IC:/gtkmm/include/atk-1.0  -LC:/gtkmm/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 -lgdk_pixbuf-2.0 -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0-lgthread-2.0 -lglib-2.0 -lintl

Result: Many errors looks like:

C:/gtkmm/include/gtkmm-2.4/gtkmm/statusicon.h:269: error: ISO C++ forbids declar
ation of `get_icon' with no type
C:/gtkmm/include/gtkmm-2.4/gtkmm/statusicon.h:589: error: `Gio' has not been dec
lared
C:/gtkmm/include/gtkmm-2.4/gtkmm/statusicon.h:589: error: `Icon' was not declare
d in this scope
C:/gtkmm/include/gtkmm-2.4/gtkmm/statusicon.h:589: error: template argument 1 is
 invalid
C:/gtkmm/include/gtkmm-2.4/gtkmm/statusicon.h:589: error: template argument 1 is
 invalid
C:/gtkmm/include/gtkmm-2.4/gtkmm/statusicon.h:589: error: ISO C++ forbids declar
ation of `property_gicon' with no type
C:/gtkmm/include/gtkmm-2.4/gtkmm/statusicon.h:599: error: `Gio' has not been dec
lared
C:/gtkmm/include/gtkmm-2.4/gtkmm/statusicon.h:599: error: `Icon' was not declare
d in this scope
C:/gtkmm/include/gtkmm-2.4/gtkmm/statusicon.h:599: error: template argument 1 is
 invalid
C:/gtkmm/include/gtkmm-2.4/gtkmm/statusicon.h:599: error: template argument 1 is
 invalid
C:/gtkmm/include/gtkmm-2.4/gtkmm/statusicon.h:599: error: ISO C++ forbids declar
ation of `property_gicon' with no type

By the way, I'm also using ``, looks like:

g++ base.cc -o base `-mms-bitfields -IC:/gtkmm/include/gtkmm-2.4 -IC:/gtkmm/lib/gtkmm-2.4/include -IC:/gtkmm/include/giomm-2.4-IC:/gtkmm/lib/giomm-2.4/include -IC:/gtkmm/include/pangomm-1.4 -IC:/gtkmm/lib/pangomm-1.4/include -IC:/gtkmm/include/gtk-2.0 -IC:/gtkmm/include/atkmm-1.6 -IC:/gtkmm/include/gdkmm-2.4 -IC:/gtkmm/lib/gdkmm-2.4/include -IC:/gtkmm/include/glibmm-2.4 -IC:/gtkmm/lib/glibmm-2.4/include -IC:/gtkmm/include/glib-2.0 -IC:/gtkmm/lib/glib-2.0/include -IC:/gtkmm/include/sigc++-2.0 -IC:/gtkmm/lib/sigc++-2.0/include -IC:/gtkmm/include/cairomm-1.0 -IC:/gtkmm/lib/cairomm-1.0/include -IC:/gtkmm/include/pango-1.0 -IC:/gtkmm/include/cairo -IC:/gtkmm/include/freetype2 -IC:/gtkmm/include -IC:/gtkmm/include/libpng14 -IC:/gtkmm/lib/gtk-2.0/include -IC:/gtkmm/include/atk-1.0  -LC:/gtkmm/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 -lgdk_pixbuf-2.0 -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0-lgthread-2.0 -lglib-2.0 -lintl`

if I use MSYS I can compile base.cc, but I need to compile it without MSYS. Another information (perhaps necessary) about PATH (maybe here is the wrong):

Path 1:

Variable name: path Variable value: C:\MinGW\bin

Path 2:

Variable name: PKG_CONFIG_PATH Variable value: C:\gtkmm\lib\pkgconfig What can I do? Please help me to solve my problem. I apologize for my English level (in case you did not properly understand my message).