0

Hi all
I want to write program in linux about
first come first served algoriyhm by using C++
but I don't know how to start???????????????
I know how to write the code in XP system.
what is the difference between programming in linux and xp?
Can anyone help?

6
Contributors
6
Replies
7
Views
8 Years
Discussion Span
Last Post by necrolin
0

it depends on your code, but as long as you use a compiler for xp / linux you should get your code to run on either with minimal changes.

0

On linux once you have created the source of your program using console editors (emacs,joe etc) or desktop editors depending on your desktop type then it's ready for compilation.
On windows IDE's compilation is by a single click and it even allows you to execute the object within the IDE.
On most linux platforms provided gcc is installed then you can compile your source file.

example:

/*Assuming the file is in your home directory*/

g++ source_file.cpp

/*where source_file is the name of your file*/

The resulting output is a.out which is the default executable of any compilation unless otherwise.

/*Execute the object */

./a.out

/*Note the preceding dot indicating current directory */

Hope it helps!

Feel free to ask!

0

Or you can use linux IDE as well

Code blocks works with both platforms (Linux and windows), there are several other good IDe's for linux

0

For process management you can simply fork() the main process and create child processes. Thats why the linux is multhithreading system. This is simply different in MS.
If you want to queue your processes as they arrive you can use the fork() to create threads for each process.

Attachments process.JPG 11.64 KB
0

If you want to queue your processes as they arrive you can use the fork() to create threads for each process.

Correct me if I'm wrong but I was under the impression that fork() creates a child process, not a thread. It basically creates a duplicate or clone of the parent process. You can then change the child process into any other process via an exec() command. If you want to create a multi-threaded program under Linux you would use posix threads. The difference between a thread and a process being, among other things, that threads share data (such as open files) and are much lighter on system resources in their use/creation.

0

Hi all
I want to write program in linux about
first come first served algoriyhm by using C++
but I don't know how to start???????????????
I know how to write the code in XP system.
what is the difference between programming in linux and xp?
Can anyone help?

If you know C++ on Windows then you know C++ on Linux. There are system specific options of course, but that would be better covered in a book on Linux programming than a forum post.

The main difference from a programmers point of view would be the tools that you have available to you. Under Linux you have many of the same IDEs as Windows has: Eclipse, Sun Studio, NetBeans... I would suggest going into the "Add/Remove Programs" tool in your Linux distro and check out what they offer. You're no more than a few clicks away from a ton of different IDEs, compilers, and other programming tools.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.