Solved

Is c++ cross platform

Posted on 2004-09-08
6
193 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

Technology Partners: 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

Suggested Solutions

Title # Comments Views Activity
C++ get user from AD  (VS6) 7 111
best sources to up-to-date in C++? 8 115
VS2015 Redefinition errors 4 104
Installshield for Embarcadero EX 10.1 Berlin 4 92
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
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 video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

739 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