Solved

Is c++ cross platform

Posted on 2004-09-08
6
191 Views
Last Modified: 2010-04-01
I would like to make prorgams in C++ run on linux. If it's possible how wud I make it run on mandrake linux 10
0
Comment
Question by:schoi_ukuk
  • 2
6 Comments
 
LVL 11

Expert Comment

by:bcladd
ID: 12010212
You need to use the right compiler and avoid any platform specifics. You won't want to use MFC or similar Windows only GUI programming parts.

Assuming you have installed the development packages (one of the things you can configure when installing Mandrake), you should have g++ installed.

If you have a standard C++ program you can save it in a file (ending with .cpp or .C; I prefer .cpp but that is neither here nor there). Then you can compile and link it with

g++ myProgram

Should produce the executable in the current directory.

-bcl
0
 
LVL 30

Accepted Solution

by:
Axter earned 20 total points
ID: 12010405
Although code created using standard C/C++ is cross platform compatible, the executable created by the compiler is *NOT*.

If you need the compiled object to be cross platform compatible, you might want to consider using Java instead.

If you intend to compile the source code on each target platform, then C/C++ can do the job, as long as you only use standard C/C++ code.

You can also use POSIX functions and still maintain a degree of platform independents.  POSIX functions are portable to all UNIX flavors including Linux.
If you’re application is simple, you don’t need to use POSIX or platform specific functions.
0
 
LVL 3

Expert Comment

by:teratoma
ID: 12013006
I think the simple question is, "How do I do C++ in Linux?"  A good start would be to look at man/info pages on gcc.  There are also huge sources of online info about Linux C++ application development.  You might want to look at www.gnu.org for some sample C++ apps you can download the source for and compile and run yourself.  
0
 
LVL 30

Expert Comment

by:Axter
ID: 12573908
schoi_ukuk,
You graded me a B on a 20 point question?????

I gave you more then 20 points worth.

Your grading history is poor.
B B B A A B B A

Please read the grading guidelines.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

786 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