943,892 Members | Top Members by Rank

Ad:
May 21st, 2009
0

Programming under linux

Expand Post »
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?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
fuzzyrose is offline Offline
6 posts
since May 2009
May 21st, 2009
0

Re: Programming under linux

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.
Reputation Points: 85
Solved Threads: 64
Practically a Master Poster
sillyboy is offline Offline
686 posts
since Mar 2007
Jun 4th, 2009
0

Re: Programming under linux

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!
Reputation Points: 11
Solved Threads: 18
Junior Poster
sureronald is offline Offline
139 posts
since May 2008
Jul 1st, 2009
0

Re: Programming under linux

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
Reputation Points: 10
Solved Threads: 1
Newbie Poster
Evil_Tidus is offline Offline
5 posts
since Jun 2009
Jul 2nd, 2009
0

Re: Programming under 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.
Attached Thumbnails
Click image for larger version

Name:	process.JPG
Views:	30
Size:	11.6 KB
ID:	10692  
Reputation Points: 14
Solved Threads: 7
Junior Poster
slacke is offline Offline
105 posts
since Jun 2006
Jul 20th, 2009
0

Re: Programming under linux

Click to Expand / Collapse  Quote originally posted by slacke ...
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.
Reputation Points: 105
Solved Threads: 25
Posting Whiz in Training
necrolin is offline Offline
223 posts
since Jun 2009
Jul 20th, 2009
0

Re: Programming under linux

Click to Expand / Collapse  Quote originally posted by fuzzyrose ...
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.
Reputation Points: 105
Solved Threads: 25
Posting Whiz in Training
necrolin is offline Offline
223 posts
since Jun 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Linux Applications and Software Forum Timeline: Partitioning for linux and windows.
Next Thread in Linux Applications and Software Forum Timeline: Running online application with xampp





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC