Re: GTK+2 & Windows



On Tue, 25 May 2004, Clive Levinson wrote:

Hi Alf,
I have had no trouble building GTK+ apps using cygwin under Windows.
A partial extract from my make file may help you solve your problem.

GTK_CFLAGS=-c -Wall -mno-cygwin -mms-bitfields -O2 `pkg-config --cflags
gtk+-2.0`
GTK_LIBS=`pkg-config --libs gtk+-2.0`
GTK_LFLAGS=-Wall -mno-cygwin -mms-bitfields -s -mwindows

gcc $(GTK_CFLAGS)  app.cpp -o app.o
windres -i resource.rc -o resource.o
g++   $(GTK_LFLAGS) -o app.exe app.o resource.o  $(GTK_LIBS)

Note that I am using the -mno-cygwin which instructs gcc not to link with
the cygwin
libraries (effectively makes cygwin gcc act like MinGW). This flag is only
probably
required for linking, not for compiling, but it doesn't seem to do any harm.

Thank you for that. Interesting that I did not find a GTK_LFLAGS in the
Makefile.
For reference my Makefile.win is as follows

# Project: BoBReprint
# Makefile created by Dev-C++ 4.9.8.0

CPP  = \Dev-Cpp\bin\g++.exe
CC   = \Dev-Cpp\bin\gcc.exe
WINDRES = \Dev-Cpp\bin\windres.exe
RES  =
OBJ  = callbacks.o interface.o main.o support.o $(RES)
LINKOBJ  = callbacks.o interface.o main.o support.o $(RES)
LIBS =  -L"C:/Dev-C++/lib" -L"C:/Program Files/Common Files/GTK/2.0/lib"
-L"C:/Dev-C++/lib" -mwindows c:/Dev-C++/lib/gtk-win32-2.0.lib
c:/Dev-C++/lib/gobject-2.0.lib c:/Dev-C++/lib/glib-2.0.lib
c:/Dev-C++/lib/gdk_pixbuf-2.0.lib c:/Dev-C++/lib/atk-1.0.lib
INCS =  -I"C:/Dev-C++/include"  -I"C:/Dev-C++/include/gtk-2.0/gtk"
-I"C:/Dev-C++/include/gtk-2.0/gdk"  -I"C:/Dev-C++/include/gtk-2.0/gdk"
-I"C:/Dev-C++/include/gtk-2.0/gdk-pixbuf"  -I"C:/Dev-C++/include/gtk-2.0/gtk"
-I"C:/Dev-C++/include/glib-2.0"  -I"C:/Dev-C++/include/pango-1.0/pango"
-I"C:/Dev-C++/lib/glib-2.0/include"  -I"C:/Dev-C++/include/glib-2.0/glib"
-I"C:/Dev-C++/lib/gtk-2.0/include"  -I"C:/Dev-C++/include/gtk-2.0/gdk-pixbuf"
-I"C:/Dev-C++/include/atk-1.0/atk"
CXXINCS =  -I"C:/Dev-C++/include/c++"  -I"C:/Dev-C++/include/c++/mingw32"
-I"C:/Dev-C++/include/c++/backward"  -I"C:/Dev-C++/include"
-I"C:/Dev-C++/include/gtk-2.0/gdk"  -I"C:/Dev-C++/include/gtk-2.0/gdk-pixbuf"
-I"C:/Dev-C++/include/gtk-2.0/gtk"  -I"C:/Dev-C++/include/glib-2.0"
-I"C:/Dev-C++/include/pango-1.0/pango"  -I"C:/Dev-C++/lib/glib-2.0/include"
-I"C:/Dev-C++/include/glib-2.0/glib"  -I"C:/Dev-C++/lib/gtk-2.0/include"
-I"C:/Dev-C++/include/gtk-2.0/gdk-pixbuf"  -I"C:/Dev-C++/include/atk-1.0/atk"
BIN  = BoBReprint.exe
CXXFLAGS = $(CXXINCS)
CFLAGS = $(INCS)-m ms-bitfields

.PHONY: all all-before all-after clean clean-custom

all: all-before BoBReprint.exe all-after


clean: clean-custom
    rm -f $(OBJ) $(BIN)

$(BIN): $(LINKOBJ)
    $(CC) $(LINKOBJ) -o "BoBReprint.exe" $(LIBS)

callbacks.o: callbacks.c
    $(CC) -c callbacks.c -o callbacks.o $(CFLAGS)

interface.o: interface.c
    $(CC) -c interface.c -o interface.o $(CFLAGS)

main.o: main.c
    $(CC) -c main.c -o main.o $(CFLAGS)

support.o: support.c
    $(CC) -c support.c -o support.o $(CFLAGS)

and under CFLAGS I find "$(INCS)-m ms-bitfields" does this make sense? and
CFLAGS is not in the link at "$(CC) $(LINKOBJ) -o "BoBReprint.exe" $(LIBS)"
which I believe prooves that I have placed the "-m ms-bitfields" in the wrong
place in the IDE?
---

Regards,
Alf Stockton    www.stockton.co.za

VYARZERZOMANIMORORSEZASSEZANSERAREORSES?



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