Solved

Is c++ cross platform

Posted on 2004-09-08
6
195 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
[X]
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
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

623 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