tags:

views:

431

answers:

8

with all the fuss about opensource projects, how come there is still not a strong standard that enables you to make portable code (i mean in C/C++ not java or c#) everyone is kind of making it's own soup. there are even some third party libs like Apache Portable Runtime.

+1  A: 

I think the main reason there isn't any single library anyone agrees on is that everyone's requirements are different. When you want to wrap system libraries you'll often need to make some assumptions about what the use cases will be, unless you want to make the wrapper huge and impossible to work with. I think that might be the main reason there's no single, common cross platform runtime.

For GUI, the reason would be that each platform has its own UI conventions, you can't code one GUI that fits all, you'll simply get one that fits just one or even none at all.

jfs
+2  A: 

Yes, there is no standard but libraries like Qt and boost can make your life much easier when you do cross-platform development.

Mladen Jankovic
+1  A: 

There are many libraries that make cross-platform development easier on their own, but making a complete wrapper for all platforms ends up being either small and highly customized, or massive and completely ridiculous.

Carried to it's logical conclusion, a complete wrapper for all aspects of an operating system becomes an entire virtual runtime. You might as well make your own programming language.

dwestbrook
+1  A: 

The ADAPTIVE Communication Environment (ACE) is an excellent object oriented framework that provides cross-platform support for all of the low level OS functionality like threading, sockets, mutexes, etc. It runs with a crazy number of compilers and operating systems.

17 of 26
+3  A: 

POSIX?

Michael Stum
A: 

If you make sure it compiles cleanly with both GCC and MS VC++, it will be little extra effort to port to somewhere else.

Steve Pitchers
+2  A: 

wxwidgets is a great abstraction layer on the native GUI widgets of most window managers.

+1  A: 

C and C++ as languages are standards languages. If you closely follow their rules when coding (That means not using vendor-specific extensions) you're code should be portable and you should be able to compile it with any modern compiler on any OS.

However C and C++ don't have a GUI library, like Java or C#, however there exist some free or commercial GUI libraries that will allow you to write portable GUI applications.

I think the most populars are Qt (Commercial) and wxWidgets (FOSS). According to wikipedia there is a lot more.

There is also boost, while not a GUI library boost is a really great complement to C++'s STL. In fact some of the boost libraires will be added in the next C++ standard.

Mathieu Pagé