Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Is c++ cross platform

Posted on 2004-09-08
6
Medium Priority
?
197 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 60 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
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 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…

670 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