Need quick guideline about C programming

:D Hi, everybody

I am about to work on c project on linux (windows is ok too).
I want to know about how to manage c project,e.g, compile, run, make it software.

I had learn c in college, but never used in software developing.
so I want to master everything about it now.
so any one could tell me how to go on this path?
at beginning what should I do,then what....
first , second ...how can I smoothly know about c programming, and projects on linux?
should I do like this
1. c programming on linux, learn complie single code files...
2.learn makefiles....
3...anything also

There are several books on Linux programming available. They tend to concentrate on Linux system calls, spawining new processes, inter-process communication, etc.

A number of these books will also have a chapter on makefiles, so use that criterion in picking your book. If all else fails, there's the O'Reilly book, Managing Projects with make. What we usually do is that we will create or "research" a working makefile for one project and then copy that same makefile to the next project and edit it for the new project. We end up forgetting how to write a makefile from scratch, but we know how to modify them.

Hi, thanks

Originally Posted by dwise1_aol

There are several books on Linux programming available. They tend to concentrate on Linux system calls, spawining new processes, inter-process communication, etc.

A number of these books will also have a chapter on makefiles, so use that criterion in picking your book. If all else fails, there's the O'Reilly book, Managing Projects with make. What we usually do is that we will create or "research" a working makefile for one project and then copy that same makefile to the next project and edit it for the new project. We end up forgetting how to write a makefile from scratch, but we know how to modify them.

I learned how to compile and run single source code file like "HelloWorld",it is easy. and I searched some about make file, but not much success. but I realized there is a tool called "automake" ,I think this what people are using, right?

is there any good source for beginners about how to create, manage C project from scratch? I think in this way I can understand many questions in my head.

I learned how to compile and run single source code file like "HelloWorld",it is easy. and I searched some about make file, but not much success. but I realized there is a tool called "automake" ,I think this what people are using, right?

I have heard about automake, but never used it. I think that it's supposed to automate part of the process of creating a makefile.

The utility in question is called make. It "executes" a makefile, which by default is a file named makefile, but you can give it another name with the extension of .mak which you give to make. A makefile names the target, which is usually an executable, and what that target depends on (namely, a list of object and library files). Then the makefile gives the command needed generate those object and library files, which would be the command-line invocation of the compiler with the appropriate options.

That makefile also has a dependency list which says what source and header files a particular object file depends on. One of the features of the make process is to only recompile the files that have changed and to leave the others alone; this was a very important consideration early on when computers were far slower and less powerful than they are now. If you change a source file (a .c), then it needs to be recompiled, but not a source file that you didn't change. However, if you change a header file (a .h), then all the header and source files that include that header file also need to be recompiled. It's that dependency list that make uses to decide what to recompile and what to leave alone. The decision as to which files had changed are based on comparing their modified timestamp with the timestamp of the target.

However, what most people use is the project management features of their integrated development environment (IDE). In your IDE (I believe you say you're trying to use Eclipse, whereas I currently use Visual Studio, but used to use the Borland C++ IDE), you create a new project and then you add files to that project. This eliminates the need for a makefile, though a number of IDEs give you the option of generating a makefile from the project.

I've never used Eclipse, but I would assume that it includes project management.

Originally Posted by alim428

is there any good source for beginners about how to create, manage C project from scratch? I think in this way I can understand many questions in my head.

As I said, some Linux programming books include instructions on working with make; eg, Wrox' Beginning Linux Programming 2nd ed by Stones and Matthew. For a more complete treatment of make, I already mentioned the O'Reilly book. I'm sure there must be web pages as well.

But if you're using gcc, then you can simply use it from the command line to compile multiple files. In the invocation, you simply list all the source files; eg:gcc -Wall -o myprog main.c file1.c file2.c
Or, you could devote an entire directory to the project and only put the source files into that directory that are part of the project. Then you could work with a hundred source files with the simple command:gcc -Wall -o myprog *.c