Sunday, August 2, 2009

Help a Linux newb?

I am new to Linux, and am using Ubuntu. I was trying to program and compile in the C programming language, but since the built in "gcc" compiler wasn't working (wrong include paths or something), I just tried downloading another program that could compile for me: Eclipse. I downloaded Eclipse on my Windows computer onto a USB, but now that I have transferred it to my Linux computer I am not sure where to go from there. I know you look for a .exe file in Windows, but on Linux?

Help a Linux newb?
First off Eclipse is going to use gcc too. GCC stands for GNU Compiler Collection. When you program in Linux you should use Kate Advanced Text Editor because it highlights keyword if saved as a .c. In order to compile you use "cd" to change to the directory and then type





gcc filename.c





This will create a executable called a.out. If you want to name your executable on compile do





gcc -o %26lt;executable name%26gt; filename.c





To run you program in the command line go ./%26lt;executable name%26gt;





Linux use ELF programs whereas windows uses PE programs. ELF programs usually don't have extensions or have a .o extension. PE programs have a .exe or .com extension. I would learn how to write Makefiles and use the text editor and command line for programming because that is where it is at in linux.
Reply:i use open suse linux... intially when you were setting it up did you also include the programming modules? or go for minumum setup? I'm guessing thats more the issue.





as said before, things to install either come as RPM's or "make" fiiles..





if gcc works.. in the shell..





open emacs


emacs hello.c (put in the hello world prog)


exit


gcc -c hello.c





if it compiles you'll get a file





a.out
Reply:rpm
Reply:Sounds like you are doing it all wrong to me.





Do you have a download manager called Synaptic on Ubuntu? That is what you should be using. It finds all the dependencies and libraries for whatever program you wish to install.





Don't try to do things manually until you understand Linux more otherwise you will screw it up.


No comments:

Post a Comment