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?

Recommended Answers

All 6 Replies

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.

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!

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

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.

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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.