Programming under linux

Thread Solved

Join Date: May 2009
Posts: 4
Reputation: fuzzyrose is an unknown quantity at this point 
Solved Threads: 0
fuzzyrose fuzzyrose is offline Offline
Newbie Poster

Programming under linux

 
0
  #1
May 21st, 2009
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?
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 686
Reputation: sillyboy is on a distinguished road 
Solved Threads: 61
sillyboy's Avatar
sillyboy sillyboy is offline Offline
Practically a Master Poster

Re: Programming under linux

 
0
  #2
May 21st, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 94
Reputation: sureronald is an unknown quantity at this point 
Solved Threads: 15
sureronald sureronald is offline Offline
Junior Poster in Training

Re: Programming under linux

 
0
  #3
Jun 4th, 2009
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!
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 4
Reputation: Evil_Tidus is an unknown quantity at this point 
Solved Threads: 1
Evil_Tidus Evil_Tidus is offline Offline
Newbie Poster

Re: Programming under linux

 
0
  #4
Jul 1st, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 98
Reputation: slacke is an unknown quantity at this point 
Solved Threads: 7
slacke's Avatar
slacke slacke is offline Offline
Junior Poster in Training

Re: Programming under linux

 
0
  #5
Jul 2nd, 2009
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
process.JPG  
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 147
Reputation: necrolin is on a distinguished road 
Solved Threads: 14
necrolin's Avatar
necrolin necrolin is offline Offline
Junior Poster

Re: Programming under linux

 
0
  #6
Jul 20th, 2009
Originally Posted by slacke View Post
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.
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 147
Reputation: necrolin is on a distinguished road 
Solved Threads: 14
necrolin's Avatar
necrolin necrolin is offline Offline
Junior Poster

Re: Programming under linux

 
0
  #7
Jul 20th, 2009
Originally Posted by fuzzyrose View 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?
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.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the *nix Software Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC