Link to home
Start Free TrialLog in
Avatar of ClaudeWalker
ClaudeWalker

asked on

Compile C project on Linux distro

I'm new to linux and I am in a computer science class where we have to write our C programs on the linux machines in the lab.  

Writing programs in the lab sucks because there is no food or drink and I have to wear pants.

Anyways I was wondering if it would be possible for me to run a virtualbox of some Unix distro and write, compile, debug and run my C programs and still have them run on the machines in the lab.

The machines in the lab are running RedHat 5.  

This is how we are supposed to compile our projects.  I'm guess that cc is the C compiler.
cc myprogram.c -o executablename
a.out -- to run the program (I think)

So is it possible to write, compile and test a C program on a virtual box and have the source be compatible with the boxes in the lab?

If so, which distro?

Also, are there any IDE's that you'd recommend as opposed to a text editor.  Preferably, so I can step through code.  

Thanks,
JOe K.
ASKER CERTIFIED SOLUTION
Avatar of mrjoltcola
mrjoltcola
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ClaudeWalker
ClaudeWalker

ASKER

Glad I could brighten your day.

Should I download the i386 or the x86_64?  It's likely the labs are using 32-bit OS right?

Any recommendations for C IDE's?
To be safe, i386 will run on either. If the PCs are recent, (last 3 years) they are likely 64-bit processors. I could only guess as to which OS bitness is running in your labs.

For Linux, consider giving Eclipse a try. It has a C/C++ version and is one of the most popular environments.

http://www.eclipse.org/cdt/
Actually you don't have to stick with Redhat 5 clones. Any recent version of Linux in the past few years will have GCC that should be perfectly adequate. You would do just fine with OpenSUSE, Ubuntu or one of the Fedora spins.
The machines are Pentium IV's.  Should I install i386 versions?

Also, will it matter that it's run in a virtualbox (Virtual Box)?

Thanks again for taking the time to answer my questions.
Go with 32-bit (i386).

As far as I know, yes, it matters regarding bitness. Virtualization tools still run on the CPU with native instructions, so while 32-bit will run on 64-bit, vice-versa won't work. Go with the lowest common denominator.
But the virtualization won't affect the compiler?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
They come on as options the install DVD.iso?  

Would I install them and then install eclipse or netbeans?
Virtuall all Linux distributions come with GCC and the other tools mentioned.

Possibly the Firewall specific distributions might not include it, but the standard distributions do. GCC Is what Linux is itself compiled with, and one of the features of Linux is the ability to recompile your own kernel. So the Kernel source code and the required compiler are included.

Just choose "Developer Tools" or similar options when installing and you'll get it.
Sweet.  Thanks for all the info guys!