www.digitalmars.com         C & C++   DMDScript  

c++.chat - Portability problems...

reply Andreas Hellander <Andreas_member pathlink.com> writes:
Hi, 

I'm a beginner with C++ and would like to know if there's any convienient way to
implement code on a machine running with Windows that will work on a
Unix-platform. I.e, is there any software that can help me correct my code so it
will run?   
Jul 20 2004
next sibling parent Arjan Knepper <arjan ask.me> writes:
Andreas Hellander wrote:

 Hi, 
 
 I'm a beginner with C++ and would like to know if there's any convienient way
to
 implement code on a machine running with Windows that will work on a
 Unix-platform. I.e, is there any software that can help me correct my code so
it
 will run?   
 
 

You mean the binary you produce? Or recompiling the code on every target platform without the need to modify the code for every target platform? Is case of running the binary look for posix on win32 and the unix-flavor you use. In the other case conform stricly to the standard language libs. Arjan
Jul 20 2004
prev sibling parent Ilya Minkov <minkov cs.tum.edu> writes:
Andreas Hellander schrieb:

 Hi, 
 
 I'm a beginner with C++ and would like to know if there's any convienient way
to
 implement code on a machine running with Windows that will work on a
 Unix-platform. I.e, is there any software that can help me correct my code so
it
 will run?   

What kind of program are you writing? What kind of portability problem are you running against? A few recommendations. If you are writing software for Unix, but your development platform is Windows, there is an emulation layer Cygwin which allows one to compile and run Unix programs and libraries on Windows. However, you run into legal trouble if you create commercial software for Windows with it. There are also independant Windows ports of many typical Unix libraries, e.g. GTK, though they are not perfect. winelib is an emulation of WinApi for Unix. If you already have complex software written which relies on Windows, this library can remedy this with the least effort, but it's not the recommended approach to writing portable software. wxWidgets is a fairly powerful cross-platform meta-GUI library. It resolves to native user interface libraries on Windows and MacOS-X, and GTK interface on Unix. It also provides some more operating system abstractions and aims to be a complete application framework. It uses no advanced C++ features. STL (STLport supplied for DigitalMars compilers) does not contain platform dependencies itself, and is available for most compilers. STLsoft is a set of libraries which extend STL by platform-dependant and other features, however it makes them work on both Windows and on Unix. The advantage of STL and STLsoft lies in their flexibility and small footprint, but they rely on advanced C++ features. Besides, this will not give you any graphical user interface, but you can combine it with wxWidgets or something alike. -eye
Jul 27 2004