Re: Porting Between Linux and Windows

2012-07-15 Thread Emmanuel Thomas-Maurin
On 06/23/2012 09:33 PM, Karl Kleinpaste wrote:
> Eric Tavenner  writes:
>> My goal is to be able to write code for the same app in either Linux
>> or Windows, and compile for both from the same code.  Is this
>> possible?
> 
> Sure.  I'm project admin for a program (Xiphos) which has a single code
> base and builds under several flavors of Linux, BSD, and Win32.  We use
> MinGW tools under Ubuntu to do the build, then transfer the result to
> Windows for testing.  We cross-build the Win32 installer.
> 
> As also mentioned, your build system will be as big a problem as
> anything.  We use waf these days, which has a few nightmares all its
> own, but it generalizes past what we formerly had in autotools pretty
> well.  The biggest hurdle we've had is getting waf's auto config to
> discover localization and related things, and we've resorted to a Big
> Ugly Hack to convince our config.h to show the right things for Win32.
> 
> Also be aware that anything to do with the filesystem in Windows will
> cause you grief unless you use glib's wrapper functions (g_chdir,
> g_setenv, g_access, ...) by which to insulate yourself from the oddities
> of UTF-16 pathnames.
> 
> --karl

One doc I found extremely useful is: http://www.iki.fi/tml/fosdem-2006.pdf

There is also: http://ricardo.ecn.wfu.edu/~cottrell/cross-gtk/

(These are links from http://www.gtk.org/documentation.php)

-- 
Emmanuel Thomas-Maurin  


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Porting Between Linux and Windows

2012-07-15 Thread Karl Kleinpaste
Eric Tavenner  writes:
> My goal is to be able to write code for the same app in either Linux
> or Windows, and compile for both from the same code.  Is this
> possible?

Sure.  I'm project admin for a program (Xiphos) which has a single code
base and builds under several flavors of Linux, BSD, and Win32.  We use
MinGW tools under Ubuntu to do the build, then transfer the result to
Windows for testing.  We cross-build the Win32 installer.

As also mentioned, your build system will be as big a problem as
anything.  We use waf these days, which has a few nightmares all its
own, but it generalizes past what we formerly had in autotools pretty
well.  The biggest hurdle we've had is getting waf's auto config to
discover localization and related things, and we've resorted to a Big
Ugly Hack to convince our config.h to show the right things for Win32.

Also be aware that anything to do with the filesystem in Windows will
cause you grief unless you use glib's wrapper functions (g_chdir,
g_setenv, g_access, ...) by which to insulate yourself from the oddities
of UTF-16 pathnames.

--karl
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Porting Between Linux and Windows

2012-06-27 Thread Eric Tavenner
Thank you all for your advice.
One of the reasons I chose Code::Blocks was the form editor and it manages
the make toolchain.
Eric Tavenner
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Porting Between Linux and Windows

2012-06-23 Thread 3rdShift
Eric,

I would suggest to go with Gtkmm [1] as it is the official Gnome C++
wrapper. It is pretty mature by now, has plenty of documentation, and
used by a plethora of real world applications. The one I would recommend
to look at and learn from is WorkRave [2]. You can quickly install and
try it out both on Linux and Windows to explore the possibilities.

Although, Gtk/Gtkmm is my personal choice,there are other C++ GUI
toolkits to consider such as Qt [3] and wxWidgets [4] which might be
tighter coupled with C++. Both have superb documentation and books
written to help you started. In his latest book [5], Stroustrup uses
FLTK [6].

Another angle to consider is commercial applicability. Here, along US
Eastern Shore, you would be hard-pressed to find any Linux work that
requires anything by Qt (sadly enough).

By the same token, employers value Java [7] and C#/.NET [8] skills more
than C/C++ these days.

good luck,
--Vlad

[1] http://www.gtkmm.org/en/
[2] http://www.workrave.org/
[3] http://qt.nokia.com/products/
[4] http://www.wxwidgets.org/
[5]
http://www.amazon.com/Programming-Principles-Practice-Using-C/dp/0321543726/ref=sr_1_1?s=books&ie=UTF8&qid=1340506852&sr=1-1&keywords=stroustrup
[6] http://www.fltk.org/index.php
[7] http://www.java.com/en/java_in_action/
[8] http://msdn.microsoft.com/en-us/vstudio/hh388566.aspx




On Fri, 2012-06-15 at 17:33 -0700, Eric Tavenner wrote:
> I am trying to teach myself C++.  My goal is to be able to write code for
> the same app in either Linux or Windows, and compile for both from the same
> code.  Is this possible?
> I have Code::Blocks 10.05 on both OSes, (Fedora 17 and Windows 7) on a 64
> bit machine.  Currently Fedora has GTK 2.24.10 and Windows has 2.22.1.  Is
> this going to cause problems with compiling?
> 
> I have some experience with many versions of basic, but almost none with C
> or C++, so please keep your answers simple.
> Thanks.
> Eric Tavenner
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Porting Between Linux and Windows

2012-06-23 Thread Chris Vine
On Sat, 23 Jun 2012 18:13:41 -0400 (EDT)
Allin Cottrell  wrote:
> You say you're learning C++. If you have good reason to do that, 
> then fine, but note that GTK itself is written in C and is 
> C-oriented. Using C++ will complicate matters. You say you're new to 
> this, so let me point out that C and C++ are separate languages and 
> although C++ interfaces for GTK are available (gtkmm) the more 
> standard development path is to use C with GTK.

To put the counter argument for someone who says he is a newbie, I
think you are looking at this from the wrong direction.  The GTK+
headers are in the subset common to C and C++, and can be used in
either language (there is also no need to use gtkmm in C++, and
sometimes good reasons not to do so).

The real question is what language best suits the problem space the
program is trying to solve.  For some things, C++ is better (in my
opinion). With C++11 auto variables, variadic templates and particularly
lambda expressions, it is quicker to write code for some problem areas
using C++ than C. The GTK+ code you write for a graphical interface
will look pretty much the same in either language, if you are not using
a wrapper, for the reasons I have mentioned.

In other words, GTK+ is the servant and not the master in language
choice here.

Chris
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Porting Between Linux and Windows

2012-06-23 Thread Michael Cronenworth

On 06/15/2012 07:33 PM, Eric Tavenner wrote:
[snip]

Other people have answered the rest of your e-mail pretty well. I'd 
recommend C over C++ as well, as explained in the other e-mails.


There are "Hello World" C source files in GTK documentation. Be sure to 
look them over.


http://developer.gnome.org/gtk-tutorial/2.24/c39.html


I have Code::Blocks 10.05 on both OSes, (Fedora 17 and Windows 7) on a 64
bit machine.  Currently Fedora has GTK 2.24.10 and Windows has 2.22.1.  Is
this going to cause problems with compiling?


Fedora allows you to cross-compile with MinGW and I use Fedora myself to 
build 32-bit and 64-bit, Linux and Windows executables. I'd highly 
recommend you compile on one platform. It makes life much easier and you 
can use GDB on Windows for any debugging needs.


Fedora carries GTK 2.24 for both Linux and Windows and I'd recommend 
sticking to this version as the Windows build of GTK 2.24 is very 
stable. Previous GTK versions were very unstable.

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Porting Between Linux and Windows

2012-06-23 Thread Allin Cottrell

On Fri, 15 Jun 2012, Eric Tavenner wrote:


I am trying to teach myself C++.  My goal is to be able to write code for
the same app in either Linux or Windows, and compile for both from the same
code.  Is this possible?


Yes, not much of a problem, particular if you cross-compile on 
Linux.



I have Code::Blocks 10.05 on both OSes, (Fedora 17 and Windows 7) on a 64
bit machine.  Currently Fedora has GTK 2.24.10 and Windows has 2.22.1.  Is
this going to cause problems with compiling?


You'll just have to watch out for symbols that are new in GTK 2.24, 
but there aren't many of those and they're clearly indicated in the 
developer documentation.


You say you're learning C++. If you have good reason to do that, 
then fine, but note that GTK itself is written in C and is 
C-oriented. Using C++ will complicate matters. You say you're new to 
this, so let me point out that C and C++ are separate languages and 
although C++ interfaces for GTK are available (gtkmm) the more 
standard development path is to use C with GTK.


Allin Cottrell
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Porting Between Linux and Windows

2012-06-23 Thread jcupitt
On 16 June 2012 01:33, Eric Tavenner  wrote:
> I am trying to teach myself C++.  My goal is to be able to write code for
> the same app in either Linux or Windows, and compile for both from the same
> code.  Is this possible?

Yes, I have a largish C/C++ program which I can build for Windows and
Linux from the same source code.

I think the difficulty is likely to be in your build system rather
than the source code. I've found building gtk programs on Windows
rather painful. I build WIndows programs on Linux with a
cross-compiler.

> I have Code::Blocks 10.05 on both OSes, (Fedora 17 and Windows 7) on a 64
> bit machine.

I've never used code blocks, perhaps it removes some of the pain from
building on win.

Try a hello world program and see if you can get it to build and run.
For example:

http://www.levien.com/gimp/hello.html

John
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Porting Between Linux and Windows

2012-06-23 Thread Eric Tavenner
I am trying to teach myself C++.  My goal is to be able to write code for
the same app in either Linux or Windows, and compile for both from the same
code.  Is this possible?
I have Code::Blocks 10.05 on both OSes, (Fedora 17 and Windows 7) on a 64
bit machine.  Currently Fedora has GTK 2.24.10 and Windows has 2.22.1.  Is
this going to cause problems with compiling?

I have some experience with many versions of basic, but almost none with C
or C++, so please keep your answers simple.
Thanks.
Eric Tavenner
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list