PDA

View Full Version : C programming Help



MikeyRibbs
March 9th, 2007, 02:42 AM
Okay, so I'm starting to learn C programming and I am using TCC to compile and Anjuta to code. Once I turn the files into .o files it wont let me open them? It's probably a n00b problem but can anyone help me out? I just want to know how to open .o files.

yabbadabbadont
March 9th, 2007, 02:45 AM
You don't. Those are compiled object files, not executables. You need to link them before they will be executable.

MikeyRibbs
March 9th, 2007, 02:47 AM
So how do I make it an executable?

yabbadabbadont
March 9th, 2007, 02:50 AM
You need to link them before they will be executable.

:D

MikeyRibbs
March 9th, 2007, 02:52 AM
I feel like such a noob and I'm sorry that I have to ask but, how do I link them?

yabbadabbadont
March 9th, 2007, 02:59 AM
http://howtos.linux.com/howtos/HOWTO-INDEX/programming.shtml

Hopefully that will provide some of the information you will need. Other than that, I would suggest searching for "linux programming tutorial" and possibly purchasing a book or two on the subject. :D

monkeyking
March 9th, 2007, 03:58 AM
just try to use some simple tools to start with.

open a plain old text editor, and write the following.


#include "stdio.h"
int main(){
printf("Hello world \n");
}


save as firstProg.c

Go to a terminal and write



gcc -o myProg firstProg.c

now it compiles and makes an "exe".
and you can run it with


./myProg


I think these hi-end programming enviroments are a little too much for beginners.

Wybiral
March 9th, 2007, 04:15 AM
I think these hi-end programming enviroments are a little too much for beginners.

I agree, in fact... I do a lot of complex programming and ALL of my compiling is done from either the command line or makefiles (which operate on the same principal as the command line).

cronholio
March 9th, 2007, 10:40 AM
If you use Anjuta, just "Build all" and you will get an executable in your "src" sub-directory.