LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-24-2006, 01:29 AM   #1
zefram
Member
 
Registered: Nov 2005
Distribution: Debian
Posts: 42

Rep: Reputation: 15
compile gtk+ app from debian for windows


Hi,

I have created a basic gtk+ gui in glade-2, using c++ output. I can compile it using the autogen.sh and make, but I would like to compile it to and windows binary. I'm running debian.

I have installed the mingw32 compiler, and I have compiled console windows binaries with it.

Can one change the compiler make uses, to the mingw32 compiler? Is the mingw32 compiler a good choice for this?
 
Old 01-24-2006, 04:59 PM   #2
nicoge
LQ Newbie
 
Registered: Dec 2005
Location: Genova, Italy
Posts: 3

Rep: Reputation: 0
I use MinGW and works fine.
my makefile (very simple) is :
SRCS = \

main.cc \

nk_sproto.c \

nk_spbase.c



MDEPS= \

Makefile \

nk_types.h \

nk_errc.h \

nk_spbase.h \

nk_sproto.h





CC=/c/mingw/bin/g++



#`pkg-config --cflags --libs gtkglext-1.0 gtk+-2.0 gtkmm-2.4`

MYCFLAGS= -g -I. -I../common $(shell pkg-config --cflags gtkmm-2.4)

MYLDFLAGS=$(shell pkg-config --libs gtkmm-2.4)




mytest.exe: $(SRCS) $(MDEPS)

$(CC) $(MYCFLAGS) -mwindows -mms-bitfields $(SRCS) -o mytest $(MYLDFLAGS)



clean:

rm -f mytest.exe
 
Old 01-25-2006, 02:24 AM   #3
zefram
Member
 
Registered: Nov 2005
Distribution: Debian
Posts: 42

Original Poster
Rep: Reputation: 15
This Makefile business is confusing me. I'm new to this.

I've replaced your Makefile with the one in the root of the output directory of glade, and when that didn't work, also $

When I type 'make' I get:

Makefile:3: *** missing separator. Stop.

I changed the CC to point to my ming, but it looks way different than yours. Why did mine install to this location and $

/usr/bin/i586-mingw32msvc-g++

(I installed it with 'apt-get install mingw32')

Also I don't recognize some of those filenames in your makefile. nk_sproto.c or nk_spbase.c. And I assume I should chan$

The files in my src directory:
Makefile
Makefile.am
Makefile.in
project4.cc
window1.cc
window1.hh
window1_glade.cc
window1_glade.hh

The Makefile.am and Makefile.in was created with that autogen.sh script.
 
Old 01-25-2006, 06:02 PM   #4
nicoge
LQ Newbie
 
Registered: Dec 2005
Location: Genova, Italy
Posts: 3

Rep: Reputation: 0
Sorry,
my Makefile was only a vary simple example. I have used to build my application.
I don't use automake (i am not very into m4)
I haven't a working windows installation now but ...
try to define in the makefile:
SRCS = project4.cc window1.cc window1_glade.cc
MDEPS= window1.hh window1_glade.hh
MYCFLAGS= -g -I. $(shell pkg-config --cflags gtkmm-2.4 )
MYLDFLAGS=$(shell pkg-config --libs gtkmm-2.4)
mytest.exe: $(SRCS) $(MDEPS)
$(CC) $(MYCFLAGS) -mwindows -mms-bitfields $(SRCS) -o mytest $(MYLDFLAGS)

keep attention, the last line must have a tab as first character.
replace gtkmm-2.4 with the version you are using
the command pkg-config looks for files in the pkgconfig directory for compiler and linker options
Maybe you need also libglade and libglademm
 
Old 01-26-2006, 12:14 AM   #5
zefram
Member
 
Registered: Nov 2005
Distribution: Debian
Posts: 42

Original Poster
Rep: Reputation: 15
Thanx for the help, but I cat't seem to get it working.

It seems that you use the windows version of mingw to compile the sources (I'm trying to compile it from within debian).

But it's ok, I'll grab the windows version today sometime and give it a go.
 
Old 01-26-2006, 12:18 AM   #6
zefram
Member
 
Registered: Nov 2005
Distribution: Debian
Posts: 42

Original Poster
Rep: Reputation: 15
o, just read the part of the tab :-)

It starts to compile, and gives the following output. I think it is a minor problem, I'll probably be able to figger it out (I used your Makefile exactly, so I probibly just need to change something)

Thanx again!

output:
/usr/bin/i586-mingw32msvc-g++ -g -I. -DXTHREADS -I/usr/include/gtkmm-2.4 -I/usr/lib/gtkmm-2.4/include -I/usr/include/glibmm-2.4 -I/usr/lib/glibmm-2.4/include -I/usr/include/gdkmm-2.4 -I/usr/lib/gdkmm-2.4/include -I/usr/include/pangomm-1.4 -I/usr/include/atkmm-1.6 -I/usr/include/gtk-2.0 -I/usr/include/sigc++-2.0 -I/usr/lib/sigc++-2.0/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/lib/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/X11R6/include -I/usr/include/atk-1.0 -mwindows -mms-bitfields project4.cc window1.cc window1_glade.cc -o mytest -L/usr/X11R6/lib -lgtkmm-2.4 -lgdkmm-2.4 -latkmm-1.6 -lgtk-x11-2.0 -lpangomm-1.4 -lglibmm-2.4 -lsigc-2.0 -lgdk-x11-2.0 -lXrandr -lXi -lXinerama -lXext -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lfontconfig -lXcursor -lpango-1.0 -lcairo -lXrender -lX11 -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0
project4.cc:8:20: config.h: No such file or directory
In file included from project4.cc:10:
/usr/include/glib-2.0/glib/gi18n.h:23:21: libintl.h: No such file or directory
window1.cc:8:20: config.h: No such file or directory
window1_glade.cc:15:20: config.h: No such file or directory
make: *** [mytest.exe] Error 1
colinux:/mnt/fullshare/c/project4/src# ls
Makefile Makefile.am Makefile.in project4.cc window1.cc window1.hh window1_glade.cc window1_glade.hh
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to compile gtk app on suse 10 hi_all Programming 2 01-14-2006 04:49 AM
Port a GTK+ app to Windows anime4christ Linux - Software 10 11-21-2005 08:28 PM
Can't compile sample GTK app slackwarefan Linux - Software 5 07-26-2005 07:57 PM
XID in Gtk APP pulsez Programming 1 07-13-2005 06:12 PM
Compile Perl Gtk on debian? dicou Linux - General 2 04-25-2005 12:03 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration