D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] C++

 

On Thu, Nov 20, 2008 at 10:05 AM, peter <peter@xxxxxxxxxxxxxxxxxxxx> wrote:
> Hi
>
> The subject of C++ has come up on another group.  (Basically Java is
> being rubbished (only good for coffee machines (hence its name)).  Any
> second now Visual Basic will surface!  (The subject is table top
> wargaming).  However...
>
> My recollection is one has different flavours of C++, particularly as
> regards the GUI (or API).  I do not think for instance that I can
> compile Microsoft C++ on my linux machine  (The stuff is just not in the
> libaries?).

C++ itself is a standard, code written that is compliant with the C++
standard should compile on microsoft, linux and mac and others no
problem.

The issue here which is confused in with C++ are GUI toolkits and
system APIs. This is in fact no different to C. In C++ C,C#  or a load
of other languages that i can use to write code that is cross platform
compatible. But if i start using windows gui components or API then
problems arise. This is what WINE does, it provides the windows API
and GUI toolkit so that native windows apps can run on Linux.

The choice of language C/C++ has little to do with it as long as you
can call the required API function in the required way you can use any
language.

To keep things cross platform you need to use APIs that are available
on all target platforms. So that probably means moving away from
Windows APIs and using something else that is ported to windows as
well.

>
> Before I stick my neck out and offer advice I am asking here to be sure
> of my facts before giving any. (If he wants to write in C++ that's his
> problem, however it would be nice if all platforms could run his game
> (which brings us back to Java (VBG).  In any case another member is
> talking of porting stuff to Linux.


http://wiki.secondlife.com/wiki/Source_archive

A fairly large C++ game that compiles on windows, linux and mac

Note that they have used OpenGL for the 3d rendering as this is cross
platform. If they had chosen DirectX then it would not be cross
platform (without messing around with emulated directX api in wine
etc). They have also used their own window tool kit in the game, but
they do have some #if LINUX type branches in the code in a few places
for basic window management and showing native File Chooser Dialogs
etc.

Robin

-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html