472,143 Members | 1,187 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,143 software developers and data experts.

Cross-platform C++ programming

I'd like to develop a simple cross-platform application in C++. I'd
like it to run in Windows, OS X, PC-BSD and Linux. From my research, it
seems I should use Qt or Gtk as a graphical library. Do you agree? Do
you have other tips? How Cygwin could help me? Thanks.

Dec 26 '06 #1
7 2419

Charles wrote:
I'd like to develop a simple cross-platform application in C++. I'd
like it to run in Windows, OS X, PC-BSD and Linux. From my research, it
seems I should use Qt or Gtk as a graphical library. Do you agree? Do
you have other tips? How Cygwin could help me? Thanks.
It might be an idea to ask around the specific communities. For
example, ask the Mac communities of what they think of Qt/Gtk apps.

There's a few other ideas.

1) Just write your code in a clean style, using MVC and other good
practices, to make cross platform GUIs much simpler. Clear separation
of GUI and model, should really help. You can write "cross platform"
C++ classes whose behaviour works the same on all platforms. For
example:

class Button {
void Push();
FunctionPointer OnPush;
};

Then you can implement your button differnetly on different platforms.
On Win, you'll use a CButton, On Mac you'll add an NSButton* to the
class's definition, I guess you'll need to write the class's definition
different on different platforms. The point is, you make a simple
consistant API, that does only what you need and no more.

DON'T write a cross platform GUI library ;) Write a partially complete
but well planned out library that does only what your particular app
needs. Or else you'll spend your whole time doing work you'll never
use.

2) Write the app in C++, but the GUI in REALbasic. REALbasic does have
some issues with it's GUI components and does produce huge executables,
so it's best to avoid if you are doing large projects. REALbasic is
great for small projects, though, like little cross platform utilities.
For medium sized, it's so-so, you won't really gain or lose by using
it.

Most "good apps" tend to have the UI written natively for each
platform... something to keep in mind.

Dec 26 '06 #2

Charles napsal:
I'd like to develop a simple cross-platform application in C++. I'd
like it to run in Windows, OS X, PC-BSD and Linux. From my research, it
seems I should use Qt or Gtk as a graphical library. Do you agree? Do
you have other tips? How Cygwin could help me? Thanks.
You can use wxWidgets too. See http://www.wxwidgets.org

Dec 26 '06 #3

Charles wrote in message ...
>I'd like to develop a simple cross-platform application in C++. I'd
like it to run in Windows, OS X, PC-BSD and Linux. From my research, it
seems I should use Qt or Gtk as a graphical library. Do you agree? Do
you have other tips? How Cygwin could help me? Thanks.
[OT]

You might want to take a look at wxWidgets:
wxWidgets URL: http://www.wxwidgets.org

'Cygwin' is a full GCC port to windows. ('nix on windows)
'MinGW' is a Minimal GCC port to windows. (use Msys for 'nix)

GUI and non-standard libs are Off Topic for this NG.

--
Bob R
POVrookie
---
Dev-C++ IDE: http://www.bloodshed.net/ (with MinGW)
MinGW (GNU compiler): http://www.mingw.org/
MinGWStudio http://www.parinyasoft.com/
Dec 26 '06 #4
Ah cool, thanks, so from what I understand, I can write code for Unix
and compile it under Windows using Cygwin. Pretty neat. I'll look more
into it.

Dec 26 '06 #5

Ondra Holub wrote:
Charles napsal:
I'd like to develop a simple cross-platform application in C++. I'd
like it to run in Windows, OS X, PC-BSD and Linux. From my research, it
seems I should use Qt or Gtk as a graphical library. Do you agree? Do
you have other tips? How Cygwin could help me? Thanks.

You can use wxWidgets too. See http://www.wxwidgets.org
Looks pretty cool. I didn't know about this one!

Any examples lying around for me to see the resulting apps?

Dec 27 '06 #6

Charles wrote:
I'd like to develop a simple cross-platform application in C++. I'd
like it to run in Windows, OS X, PC-BSD and Linux. From my research, it
seems I should use Qt or Gtk as a graphical library. Do you agree? Do
you have other tips? How Cygwin could help me? Thanks.
No doubt about it, use QT. I've been using it since Version 2.0 and
nothing else I've tried even comes close. I use the commercial version
so I have database, socket and the like across all platforms. It's
really good. I've been programming since 1981. The best way in Windows
is Visual C++ and in Linux, I use KDevelop with GCC although it doesn't
matter, they give you all the source code and you use any platform you
like, Borland, Eclipse. You can download it free from
www.trolltech.com. I went to it because I develop OpenGL 3d programs
but it's 2d library is second to none.

Pierre

Dec 27 '06 #7

co**********@googlemail.com wrote in message ...
>
Ondra Holub wrote:
>You can use wxWidgets too. See http://www.wxwidgets.org

Looks pretty cool. I didn't know about this one!

Any examples lying around for me to see the resulting apps?
Go to the site, look around. Download the full source or specific platforms
source. Comes with sample/example programs to demonstrate the features.

Or, get the docs and read a little to see if it's what you want.

Further discussion discouraged, it's Off-Topic.
There is an wxWidgets NG.

--
Bob R
POVrookie
Dec 27 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by rollasoc | last post: by
1 post views Thread by Rob Woodworth | last post: by
6 posts views Thread by Bart Van der Donck | last post: by
6 posts views Thread by ampo | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.