Cross-platform C++ programming

C

Charles

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.
 
C

collection60

Charles said:
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.
 
O

Ondra Holub

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
 
B

BobR

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.
 
C

Charles

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.
 
P

pierrechicoine

Charles said:
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
 
B

BobR

(e-mail address removed) wrote in message ...
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top