Solved

Is c++ cross platform

Posted on 2004-09-08
6
189 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
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 technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

743 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now