is GTK 3.x a real cross-platform solution? - c++

I have tasted both Qt 4.x/5.x and GTKmm 3.x and I really like GTKmm over Qt.
Now I have just discovered that GTKmm 3.x doesn't offer a Windows porting, they also do not offer a Mac porting, basically I can't find nothing but libraries/sources/binaries for Linux.
Apparently the Windows support ( I'm not sure about the situation for the Mac OS stuff ) was dropped in the 2.x era and it's still not-existing today.
I have planned to use GTK 3.x for specific reasons, especially for some new features introduced by the 3.x branch, so using GTK 2.x is an option off the table.
Now I ask: there is something new for the Windows and/or Mac support for GTK 3.x ? There is something ? even experimental projects ?

No it isn't - at least when you want to be on the safe side for the future. The MacOSX and GTK ports are less then perfect and completely voluntarily which means by a program of this complexity and size they are not not active developed. And nobody cares that old features are implemented before new are added.
Almost 2 years since GTK3 released and there is still no official Windows binary distribution. And on one of the GNOME conferences there was an open discussion if GTK4 should be made Linux only. Well i guess they mean Linux/BSD - but Wayland is pure Linux at the moment and BSD do have a lack of developer for Desktop stuff.
This should be enough to scare any person with a serious program which requires real world investment away.
Also i strongly belive that cross platform GUI toolkits are a thing from the past. Abstract the GUI of your app and develop for every platform. With the success of the AppStores you will be forced more and more to use the native platform style. Your app will already be rejected by Apples AppStore if it looks to different. Windows is now enforcing WinRT. Be prepared that this will just be more important in the future.
So the way to go is WxWidgets which uses native widget sets. Skip GTK

2018-12-18 Update:
GTK+ 3 on Windows has been supported through MSYS2 for years.
Old answer:
GTK for Windows is currently provided "as-is". What it means, basically, is that there are no GTK maintainer that use Windows, and those using Linux have enough work maintaining the Linux builds.
This means that any contribution for GTK 3 on Windows is welcome, some people are using it, but that's not ready for the masses because nobody steps up to do the work, which won't be done by magic overnight. So it's usable, but don't expect reactive maintenance.
As for the build, there's a french dude providing an (unofficial) GTK 3 installer for Windows.

As of right now, no.
Like Frédéric Hamidi said, see Where can I download precompiled GTK+ 3 binaries or windows installer? for more info.

GTK on Mac has worked well for a long time and continues to work into the 3.x series:
https://live.gnome.org/GTK%2B/OSX/Building
You can also install GTK 3.x using MacPorts, but I don't know how well that works.

Related

GUI Programming C++ for Mac OS X Lion

I'm probably going to get abuse for this question but here goes. Oh but before you tear into me and tell to crawl back under a rock etc. I have looked high and low and nothing has helped me so far either the software libs are out of date and for some reason wont work on lion.
Ok other than Qt is there any other lightweight opensource GUI library for C++ on mac? I have tried this wxWidgets doesn't work for some reason. Apple don't seem to offer that carbon crap anymore or can I use openGL to create GUI's? I just want a simple nicely documented GUI lib without having to switch to windows to develop. or will I have to spend some money on one or resort to Qt.
Hope someone can help and thanks!
Why not use Cocoa (the native way to develop OSX GUIs) in the first place? You must use the Objective-C calls to create windows for example, but you can mix this code with C++ code in the same file - this is then called Objective-C++ and it is supported by clang and the gcc.
To build completely native-looking OSX Applications, you need Cocoa. Every other toolkit that can create those native GUIs calls Cocoa (at least to my knowledge).
Just as a pointer: have you tried SDL?
FLTK is simple and very stable GUI library. Runs on Windows, OS X and Linux.
Non-native look though.
Here is a screenshot of an app I built with it a few years ago, and that still runs great on Lion.
I'd take a look at both GLUT and GLUI as simple extensions to OpenGL that provide basic widgets. They can be used together to some degree, but I personally have run into a couple issues in that department. Either one in isolation is pretty simple to use if you're familiar with OpenGL though.
EDIT: Also, X11 can run in OS X, although I'm not familiar enough with the system to know how to get started with that.

Which Linux distribution should I go for learning C/C++/Assembly in Linux

I am a primary windows developer with experience in C#, .NET, Visual C/C++. I want to lean C/C++ development in linux in order to create portable GUI applications which run on both Windows and Linux.
I have used Fedora in past (2005). Want your suggestions to know which is the best distribution currently to learn programming in linux.
You can't really go wrong with any of the major ones. Personally I use Debian, but Fedora and OpenSUSE are good choices as well.
I would also like to point out that you can use C# to create portable GUI applications. Have a look at Mono and Gtk#. I have developed quite a few Gtk# apps and they usually run flawlessly on Windows and Linux, with very little work on my part. It might not be a bad introduction to coding on Linux, as you will be able to use a familiar language.
Any modern Linux distribution will do, as they all includes (or makes it easy to install) GCC. To easily create portable GUI applications, I would recommend taking a look at Qt.
Since every distro worth its salt has a Development Package that includes gcc, g++ and gdb, it's really going to come down to the IDE you develop your code in. Eclipse is an excellent IDE for C & C++ which just happens to be written in java. So long story short, use whatever distro you are comfortable with, it really doesn't matter all that much.
There is none Distribution you couldn't use. If you want an easy distribution working almost out of the box. With a lot of things configured automatically i would suggest you use ubuntu.
If you like to do more things on your own I'd tend to debian. Anyway you could simply code with qt and use the linux box for debugging only.
Slackware, ArchLinux or CentOS.
Stay away from Ubuntu and its derivatives, you will spend more time messing with packet manager apt-get than doing code. If you choose Debian-derivatives you will spend time wondering why your programs dont work only to find out you need packetname-devel also (!)
A base Slackware install should be enough to get you started, if you would like to keep having the latest programs, use ArchLinux.
You wrote "to create portable GUI applications which run on both Windows and Linux" - I suggest that you consider Qt (used to be from Trolltech now part of Nokia). http://qt.nokia.com/products/

Switching to Linux for Windows development, bad idea?

I was contemplating switching to Linux for C++ development, coming from a Windows environment. Is this a bad idea? My workplace uses Windows and Visual Studio for our projects (some C# and java too, but right now I'm only developing in C++). If they decide to put me on a C# project, would development still possible (mono?)? What are the difficulties in this sort of transition?
Would I have a problem working on their projects and vice versa? I read somewhere that there'd be problems with precompiled headers and such (we do use them), and encodings (tabs/spaces, line endings, etc)..
If it's not too hard to do this switch, how do I get started? IDE? vim+make?
Thanks.
By the way, we make MOSTLY windows software..
EDIT: Thanks guys, I guess that makes sense..
That's a bad idea. I can see at least two reasons :
Develop on the same OS you write software for
Visual Studio rocks
Stick with Windows if you're developing for C++ and C#.
The Visual Studio debugger is absolutely brilliant, and it seems that most of the Linux IDEs aren't comparable (except Eclipse for Java stuff).
Also, the chances are that you'll be using a different compiler if you're on Linux, and that can cause really weird bugs.
I'm a Mac user (former FreeBSD guy), so I understand your gut feeling. In short: you're going to want to use Visual Studio. It's the best tool there is for your C# projects, period. It's also the best tool for your Windows-centric C++ programming. Even if it wasn't, your testing is going to suffer if you don't run the OS it's going to run on.
On the bright side, always do your development in a virtual machine. Especially on Windows. Use source control and take frequent snapshots of your VM. When you're doing this, it doesn't matter if you run Linux or OS X on your host.
Cheers
Nik
Not a very good idea because support for Windows Forms in mono isn't complete yet. Linux c# developers usually use GtkSharp for GUI, which will add another dependency to your app and is quite different from Windows Forms. But GtkSharp isn't bad either. I especially like the packing boxes feature of GTK because it makes my controls (err, widgets) much easier to resize properly and automatically eliminates all screen DPI problems.
But there is also a chance that your existing code might have other dependencies which are not present on Linux, especially unmanaged code called with P/Invoke. If that's the case, doing the development on Linux might be impossible.
I currently develop on both windows and linux. I find it's pretty useful to compile the same code under those two (or maybe more) platform, as you can find some coding errors thanks to vc++ and some other thanks to gcc. Of course, the most important platform is the one you are developing for. If your application will run on windows, develop it on the same platform and only if you can allocate more resources, try to port it on linux or other.
Anyway, it's a good habit to think about portability during develop, it implies to use standard solutions as much as possible
I have switched to doing web development on linux,
here's what I have personally found
In order to do things right that doesn't cause problems in the end (using particular software) I have to have a virtual machine. Wine isn't far enough along to be stable for the software I need
Also for my particular needs, just the whole "System Font" being different has caused numerous scripting issues b/w windows and unix/linux
I am going to be switching back to win. I LOVE LINUX, but in a specialized field where the majority of my clients use windows and IE .... I need to run with what they have...
I think this is the smartest for productivity
(personal opinion, not mandate from God)
tim
I suggest sticking to windows. Windows is great for windows development. Linux is where you can write cross-platform stuff/ Linux specific stuff (if you wish). I tried Mono for learning C#, it worked for toy examples, but not for some parts of .NET. I switched back to windows. I can't imagine it is a good idea to switch to Linux. I intend no offense, this is just my opinion.
If you're missing a lot of Linux -- and you need to stay on a Windows box to interact with your team AND your work application -- install Cygwin and the GNU Win32 tools.
If you where absolutely sold on Linux, VMWare is very good for running a virtual machine and if you compile your Linux / cross-platform programs using the mingw toolchain, adding a single dependency, which can be statically, you shouldn't get any windows errors.

How to Compile for OS X in Linux or Windows?

I would like to port my C/C++ apps to OS X.
I don't have a Mac, but I have Linux and Windows. Is there any tool for this?
For Linux, there is a prebuilt GCC cross-compiler (from publicly available Apple's modified GCC sources).
https://launchpad.net/~flosoft/+archive/cross-apple
Update for 2015
After so many years, the industry-standard IDE now supports OSX/iOS/Android.
http://channel9.msdn.com/Events/Visual-Studio/Connect-event-2014/311
Embarcadero's RadStudio also supports building OSX/iOS/Android apps on Windows.
This answer by Thomas also provides a cross-compilation tool.
For all these options you still need a real mac/i-device to test the application.
I have created a project called OSXCross which aims to target OS X (10.4-10.9) from Linux.
It currently supports clang 3.2 up to 3.8 (trunk) (you can use your dist's clang).
In addition you can build an up-to-date vanilla GCC as well (4.6+).
LTO works as well, for both, clang and GCC.
Currently using cctools-870 with ld64-242.
https://github.com/tpoechtrager/osxcross
There appears to be some scripts that have been written to help get you set up cross compiling for the Mac; I can't say how good they are, or how applicable to your project. In the documentation, they refer to these instructions for cross-compiling for 10.4, and these ones for cross compiling for 10.5; those instructions may be more helpful than the script, depending on how well the script fits your needs.
If your program is free or open source software, then you may wish instead to create a MacPorts portfile (documentation here), and allow your users to build your program using MacPorts; that is generally the preferred way to install portable free or open source software on Mac OS X. MacPorts has been known to run on Linux in the past, so it may be possible to develop and test your Portfile on Linux (though it will obviously need to be tested on a Mac).
Get "VMware Player"
Get "Mac OS X vm image"
Compile/Debug/Integrate-and-test your code on the new OS to make sure everything works
When you are trying to get something working on multiple platforms you absolutely must compile/run/integrate/test on the intended platform. You can not just compile/run on one platform and then say "oh it should work the same on the other platform".
Even with the a really good cross-platform language like Java you will run into problems where it won't work exactly the same on the other platform.
The only way I have found that respects my time/productivity/ability-to-rapidly iterate on multiple platforms is to use a VM of the other platforms.
There are other solutions like dual-boot and ones that I haven't mentioned but I find that they don't respect my productivity/time.
Take dual-booting as an example:
I make a change on OS 1
reboot into OS 2
forget something on OS 1
reboot into OS 1
make a change on OS 1
reboot into OS 2 ... AGAIN...
BAM there goes 30 minutes of my time and I haven't done anything productive.
You would need a toolchain to cross compile for mach-o, but even if you had that, you won't have the Apple libraries around to develop with. I'm not sure how you would be able to port without them, unfortunately.
Apple development is a strange beast unto itself. OS X uses a port of GCC with some modifications to make it 'appley'. In theory, it's possible to the the sources to the Apple GCC and toolchain as well as the Apple kernel and library headers and build a cross compiler on your Windows machine.
Why you'd want to go down this path is beyond me. You can have a cheap Mac mini from $600. The time you invest getting a cross compiler working right (particularly with a Windows host for Unix tools) will probably cost more than the $600 anyway.
If you're really keen to make your app cross platform look into Qt, wxWidgets or FLTK. All provide cross-platform support with minimal changes to the base code. At least that way all you need to do is find a Mac to compile your app on, and that's not too hard to do if you have some technically minded friends who don't mind giving you SSH access to their Mac.
You will definitely need OS X somehow. Even if you don't own a Mac, you can still try some alternatives.
I found this small documentation on the net:
http://devs.openttd.org/~truebrain/compile-farm/apple-darwin9.txt
This describes exactly what you want. I am interested in it myself, haven't tested it yet though (found it 10 minutes ago). The documentation seems good, though.
You can hire a mac in the cloud from this website. You can hire them from $1, which should be enough (unless you need root access, then you are looking at $49+).
There are a few cross-compiler setups, but nearly all of them are meant for distcc-style distributed compiling. To my knowledge there is no way to directly target the Mac platform without actually having a Mac. The closest you can get without resorting to QT or wxWidgets is OpenStep with GNUStep or similar, but that's not a true Cocoa platform, just very close.
I know this question isn’t very active but answering anyways. Why don’t you try using TransMac, then download the XCode image and do it that way? Or you can use a VM, or Sosumi. You’ll find a video on youtube about sosumi, definitely.
The short answer is kind of. You will need to use a cross-platform library like QT. There are IDE's like QT Creator that will let you develop on one OS and generate Makefiles for others. For more information on cross platform development, check out the cross-platform episodes of this podcast (note that the series isn't over and new episodes appear to come out weekly).
As other answers explain you can probably compile for a Mac on Windows or Linux but you won't be able to test your applications so you should probably spend the $600 for a Mac if you’re doing professional programming, or if you’re working on open-source software find a developer with a Mac who will help you.

How to get started with Maemo software development [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
A few months ego I purchased Nokia N800 device and since then I'm itching to write some code for it. I know that some of the application I'm running are written in Python and that there is a Mono port for the Maemo platform as well.
Basically what I'm asking is:
Is there a recommended development language for Maemo platform?
What development tools exist?
Can I use Windows or Linux as my primary development machine, and which do you recommend and why?
I highly suggest that you try C++ and QT.
QT is already well supported for Diablo and Fremantle, and the next release of Maemo (Harmattan) should be based on QT.
Learning QT will be much much easier than GTK+, coding will be faster and more fun, your application can be compiled in various platforms and you can even develop and debug in Windows, then simply run a qmake && make in a scratchbox environment.
Take a look at this tutorial: Getting started wit QT for Maemo
You still need a Linux box to compile your code for a Maemo device.
If you are using windows, you can setup ubuntu (or kubuntu) in a VirtualBox machine.
Maemo SDk + along with Scratchbox 2 is a better alternative than Maemo SDk & Scratchbox.
Personnally, I'm using QT creator in Windows, kubuntu 9.04 in VirtualBox, and I've never been happier.
When I started, I tried the "official" approach : Ubuntu, GTK+, C language and scratchbox 1. ... that was painful.
The Hildon framework is made up of GTK+ extensions, so the language is C. You can use C++ wrappers (maemomm) too. Or you can go with pymaemo for building apps with Python, which to me is much easier than C or C++. I've also seen an attempt at a ruby port, but have not followed up with that project recently.
For the development environment, there is "scratchbox", which gives you a sandbox for compiling and running your app. Here's a link on how to set up a scratchbox development environment. (It sure took me a long time to get everything setup.)
You'll have to use Linux as your development machine because your Nokia N800 is really a mini Linux computer.
If you want to have an IDE experience, try the ESbox plugin for Eclipse.
Have fun hacking!!!
I've just found two tutorials on Maemo.org:
Writing Hildon Desktop Plug-ins for Maemo 3.x
How to write maemo desktop plugins for maemo 4.x
For extra on-the-go fun, you can get the linux gcc and make tools running on the tablet itself and do your programming and compiling on the device.
For any help with this sort of stuff the Maemo Talk forums are fantastic.
Ruby for Maemo is being hosted at http://code.scottishclimbs.com/maemo/
I've not yet tried it myself.
There's a Scratchbox Virtual Appliance for Maemo development (I'm not sure if the link is the right one) but that's how I started hacking. It took forever for me to figure out how to set up scratchbox by myself.
I have to echo Karatchov's response.
The 2 recommended approaches currently are:
Python + PyGtk
C++ & Qt
Using anything else, you set yourself up for some pain (unless you are a Gtk+ veteran - since you are asking this question, I assume you are not). C++ & Qt is the future of Maemo anyway, and Qt works well on "old" platforms such as Diablo.
As a debugger, I recommend you pick up (compile) "cgdb". The plain old gdb can be a bit too spartan.
Generally, you should develop your application as a "normal" Qt application using Qt Creator, and occasionally test it in scratchbox.
Nokia has been working hard to provide tools and documentation for developers. I would say one of the best places to start is at Forum Nokia:
http://www.forum.nokia.com/Technology_Topics/Device_Platforms/Maemo.xhtml
The next stop for developing for Maemo is of course Maemo's headquarters:
http://maemo.org/development/
These two links are to portals where you'll have to drill down for further info, but they are pretty good starting points. Now to answer your questions directly:
I suppose the two 'recommended' languages are C and python. While these are well supported, they are not the only choices as you have seen from previous answers. In addition to those languages, perl is on the device, though it is not in the same state as it is on debian.
The chief development tool is the SDK. It allows you to test the environment and compile software for the device. You can also use Eclipse for which there are plugins.
It is recommended that you use linux as a development machine, but you can run it in a virtual machine on Windows. While I prefer my OS to be 100% free and therefor choose debian, Nokia is working hard to make a better development environment for Windows. So rest assured that Nokia does not necessarily share my bias! :-)
I develop mainly with python and pyside (I develop on an N900).
I have all my files in the nokia N900 and I use sshfs to mount my home directory on my pc.
I then develop on my desktop, while actually saving everything right into the cell phone, and use SSH to run it remotely.
If you get too lazy to even pick up the device to look at the screen, you might want to use VNC; though personally, I feel it's just not responsive enough.
Yes, all I have on my desktop is my editor (sublime-text, by the way). The rest live on the mobile device. I use git to sync things/make backups, etc.
py2deb is great for making packages once you want to distribute your proyect. Again, no need to install anything on your desktop.
IF you'd rather be more conservative, the SDK is designed for debian, and you'll suffer a lot with any non-debian-based OS (unless you use a VM). Be warned! :)