Re: Questions I should have asked



Hi Alf,
I find that all one needs to develop for GTK on windows, is a decent
text editor and Cygwin.
1. Install Cygwin

2. Install GTK runtime and developer packages. I download these
from http://www.dropline.net/gtk/download.php . It seems that the maintainer
of these packages is no longer going to be updating these in the future.

3. Create hello.cpp:

#include <gtk/gtk.h>

int main(int argc,char *argv[])
{
  gtk_init(&argc, &argv);
  GtkWidget *window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_widget_show(window);
  gtk_main();
  return 0;
}

4. Create hello.o by compiling from the cygwin shell using:
gcc -c -Wall -mno-cygwin -mms-bitfields -O2 `pkg-config --cflags gtk+-2.0` hello.cpp -o hello.o

5. Link to create the exe:
g++ -Wall -mno-cygwin -mms-bitfields -s -mwindows hello.o -o hello.exe `pkg-config --libs gtk+-2.0`

You should now have an executable windows application (that you will have to kill to shutdown).
You can run:
pkg-config --cflags gtk+-2.0
pkg-config --libs gtk+-2.0
from the command line to see what they do if you like?

Hopefully this will get you up and running.

Regards,
Clive



Message: 13
Date: Sat, 29 May 2004 13:56:24 +0200 (SAST)
From: Alf C Stockton <alf stockton co za>
Subject: Re: Questions I should have asked
To: gtk-app-devel-list gnome org, dev-cpp-users lists sourceforge net
Message-ID: <Pine LNX 4 58 0405291347310 1193 puppypad co za>
Content-Type: TEXT/PLAIN; charset=US-ASCII

Thank you for all the replies I received it makes me feel good that I am not
necessarily the only one on the bleeding edge of using Open Source on Windows.

While I attempt some of the compiler/linker switches suggested may I put the
following problem forward again.

I am now getting Gtk-ERROR** Incompatible Build when I attempt to
 run my Linux developed application on Windows.
>
Tor Lillqvist <tml iki fi> original reply was:-

> Doesn't the message say what to do? This message comes from this
> g_error() call:
>
>     g_error ("Incompatible build!\n"
>            "The code using GTK+ thinks GtkWindow is of different\n"
>              "size than it actually is in this build of GTK+.\n"
>            "On Windows, this probably means that you have compiled\n"
>            "your code with gcc without the -fnative-struct\n"
>            "(or -mms-bitfields) switch, or that you are using\n"
>            "an unsupported compiler.");
>
> I.e. you need to compile your source code with the -mms-bitfields gcc
> switch.
>

Tor thank you for this suggestion but when I attempt it by adding the
-mms-bitfields to the linker options I still get "Incompatible build!" & when I
add it to the compiler switches I get told by cc1.exe that "output filename
specified twice".

I get the same effect if I use -fnative-struct so now I am really confused.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]