Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Source code that compiles on Win NT as well as LINUX

Posted on 2002-05-27
15
213 Views
Last Modified: 2010-04-22
Hi all,
I am new to LINUX development. We have a requirement where a customer wants to write a C/C++ application in such a way that it can be compiled seamlessly both on Win NT as well as Win2000.

In my opinion, what we will need is a kind of NT/LINUX compatible C++ library on which we write the application. This intermediate layer will take care of the OS dependent features.

I would like to know from the experts if such a possibility exists or are there any other approaches.

(JAVA is ruled out because of performance issues)

Thank you.

0
Comment
Question by:saurabh_dasgupta
  • 4
  • 3
  • 3
  • +5
15 Comments
 
LVL 4

Author Comment

by:saurabh_dasgupta
ID: 7038473
I forgot to mention that , a GUI is an essential requirement for the application. The GUI will need to have buttons,edit fields , radio buttons, etc.


0
 
LVL 1

Expert Comment

by:tekweni
ID: 7038739
Alas there is no all-in-one library that provides compatibility between nt/unix.  My environment requires the same codebase to run on solaris/hpux/linux/aix and also nt/2000, and the best we've been able to do is make wrappers for the functions that behave differently, so they at least look the same to the application.  That's not as nightmarish as it sounds and for my needs is confined to threading, gettime, directory io, and gethostinfo.  I use #ifdefs to conditionally compile the applicable code, pretty much like everyone else I guess.

The only way I know around this is to write for Cygwin running on top of NT - that way you get to use the Gnu compiler but you'll still be limited in other ways.

For a gui, you may want to consider FLTK (www.fltk.org).  This is basically a stripped-down clone of GTK+, but whereas a NT port of GTK+ is "coming", FLTK compiles and runs on both unix/nt today.  Quick and easy to get into, and provides a rich enough set of features.

Hope this is useful...
Kim
0
 
LVL 4

Author Comment

by:saurabh_dasgupta
ID: 7038763
Thank you for the lead. I will investigate FLTK.
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 51

Expert Comment

by:ahoffmann
ID: 7038915
have a look at NuTCRACKER at http://www.datafocus.com/
not shure if it is still supported,.
0
 
LVL 5

Expert Comment

by:garboua
ID: 7040428
tekweni is right on the money when it comes to your code.  #ifdef  OS will be your best friend for OS specific calls.  won't take much to master it.
I don't know about FLTk, but you cat take a tcl/tk application from one platform to another Easily, minimal work.  the libraries are almost the exact same, and you will not neet any os  specific interface, it will take care of that for you, and it supported by almost all os, solaris, IRIx, linux windows, arrrgs :-), etc etc etc.
0
 
LVL 4

Accepted Solution

by:
ct.smith earned 200 total points
ID: 7040470
Qt (www.trolltech.com) is very good at allowing the same code on Windows and Linux.  Quite often, there is no need for sections of code for a specific OS.  Also, there is the utility qmake (comes with Qt) that can generate Makefiles for Linux and Visual Studio projects automatically for the same code.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7040533
I'd vote for Tcl/Tk too, but the question says C/C++ (heavan knows why making things complicated when they can be sooooo simple;-)
0
 
LVL 5

Expert Comment

by:garboua
ID: 7041633
ahoffmann,
true, the question sys c/C++, but then he/she wrote
>>I forgot to mention that , a GUI is an essential >>requirement for the application. The GUI will need
>>to have buttons,edit fields , radio buttons, etc.
And that is why I brough up tck/tk.  
U slipping dude, U slipping Ha ha ha ha ha ha LOL



0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7042375
BTW, I don't know anything where I need C/C++ for, which cannot be done with Tcl/Tk (except writing #ifdef in C code;-) leaving the performance issue beside ..
0
 
LVL 2

Expert Comment

by:fremsley
ID: 7044821
> (JAVA is ruled out because of performance issues)

Have you tested the new JDK 1.4 from Sun?

Hope it helps
0
 
LVL 5

Expert Comment

by:garboua
ID: 7050981
1.4 still have issues and I would not suggest it for PRODUCTION.
0
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 7056243
If Pascal is possible then Delphi (for Windows) and Kylix (Delphi for Linux) could be used. It has two GUI class trees. VCL for Windows only and CLX which is based on QT and cross platform.

I prefer Delphi over MS Visual Studio because it is easier to use.
0
 
LVL 1

Expert Comment

by:MaxMaxic
ID: 7092172
Hi.
If you can consider the commercial products, I would recommend Visual MainWin of Mainsoft. (http://www.mainsoft.com).
Basically, this is a tool that enables to you to take your code from NT/2000 and port it automatically to one of the supported Unix/Linux platforms. See the web site for the details.

Hope it helps.
0
 
LVL 4

Author Comment

by:saurabh_dasgupta
ID: 7092737
I would like to thank all of you for the attempts that you have made and put an end to this thread:

I have been using the leads provided here, and I will have to accept more than 1 comment as an answer:

[+]
Java approach is ruled out. JAVA is several times slower than it's native counterpart. (w.r.t JDK 1.3, 1.4 has not been tried out. I understand that it has a better graphics architecture)

[+]
TCL/TK and Pascal development is also ruled out, because my organization does not have trained resources.

[+]
FLTK ,TROLLTECH and MAINSOFT are very good suggestions. Out of these 3, my team has zeroed down on TROLLTECH and MAINSOFT as the probable candidates.

So I would like to split the points between
MaxMaxic   and ct.smith


Thank you everybody
0
 
LVL 4

Author Comment

by:saurabh_dasgupta
ID: 7092761
Thank you. I will float another dummy question for MaxMaxic.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

766 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question