help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tools for C Programming


From: Richard Riley
Subject: Re: Tools for C Programming
Date: Sat, 07 Mar 2009 20:30:16 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.91 (gnu/linux)

pjb@informatimago.com (Pascal J. Bourguignon) writes:

> "Chengqi(Lars) Song" <songcq@gmail.com> writes:
>
>> hi,
>>
>> I've been using emacs for a long time but I've just started to write C 
>> program in emacs. I need some functions but dunno how to configure. Maybe 
>> you can give me some suggestions.
>>
>> 1. The folder structure is like:
>>    abc-+-
>>        |--MakeFile
>>        |--src-+-
>>               |--main.c
>>
>>    after I use C-x C-f to open main.c, how to 'make' when the
>>    MakeFile is in the parent folder?
>
> M-x compile RET C-a C-k make -C /home/chengqi/src/abc/Makefile all RET
>
> next time you can just do:
>
> M-x recompile RET
>
>
>> 2. How to display function list?
>>
>>
>> 3. How to auto-complete identifier names, struct memebers, and hints
>>    for function parameters?
>>
>>
>> 4. How to jump to definition?
>
> ECB is the most complete package to do that. 
> http://ecb.sourceforge.net/
>
> Otherwise, there are also tools such as tags (use etags(1) to build a
> TAGS index, and use M-. to jump to the definition(s) of a symbol,
> M-TAB to complete a symbol, etc).
>
>
> Put this in your Makefile:
>
> tags etags:
>       find $(SRCDIR) \( \( -name \[#.]\?\* -prune \) \
>                         -o -name \*.h -o -name \*.c  \
>                         -o -name \*.hh -o -name \*.hxx -o -name \*.cc -o 
> -name \*.cxx \) \
>                         -print \
>        | while read f ; do echo $$f ; etags -a -o $(SRCDIR)/TAGS $$f ;
>       done

I just have

ctags-exuberant  -e --recurse=yes --links=yes --verbose=no


>
> M-x compile RET C-e tags RET
>
> and then type or move after the name of a function, and type M-.

I suggest cscope. It's much better than tags.



-- 
 important and urgent problems of the technology of today are no longer the 
satisfactions of the primary needs or of archetypal wishes, but the reparation 
of the evils and damages by the technology of yesterday.  ~Dennis Gabor, 
Innovations:  Scientific, Technological and Social, 1970


reply via email to

[Prev in Thread] Current Thread [Next in Thread]