finding where the functions are defined and implemented

This is a discussion on finding where the functions are defined and implemented within the C Programming forums, part of the General Programming Boards category; Hi, As a newbie to C, I'm not familiar yet with finding your way around bigger projects. But it seems ...

  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    245

    finding where the functions are defined and implemented

    Hi,
    As a newbie to C, I'm not familiar yet with finding your way around bigger projects. But it seems to me, that finding where a function is implemented is a bit problematic with C, as header files include other header files, which include others, etc etc.

    Is there an easy way to find out where the functions are located? Do I need an IDE for this?

    In regards to IDE's, the projects here are simply maintained in directories. There are no "project" files, like some IDE's create. KDevelop is able to understand this directory based structure, but QDevelop is not. KDevelop, however, doesn't let you go to where the function is.. you have to do that grep, which sometimes returns 200+ results.

    What good IDE can handle a directory-based structure and allows you to find where functions are declared/implemented easily?

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    23,021
    There is no "easy" way. How could there be? An IDE/compiler cannot know where something is defined. Usually they're categorized somehow, so that's your best bet. Alternatively, some IDEs have code completion tools which can find where a function is defined. May not always find the right function, though.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Registered User
    Join Date
    May 2010
    Posts
    245
    Quote Originally Posted by Elysia View Post
    There is no "easy" way. How could there be? An IDE/compiler cannot know where something is defined. Usually they're categorized somehow, so that's your best bet. Alternatively, some IDEs have code completion tools which can find where a function is defined. May not always find the right function, though.
    Well, Eclipse can do it quite easily with Java, so I'm assuming something can be done with C. With eclipse and Java, you just right click the function and select "go to definition".

    I don't think Eclipse handles a directory structure for projects well.

  4. #4
    Password:
    Join Date
    Dec 2009
    Location
    NC
    Posts
    587
    Java != C

    In Java, there is a class per file rule. It's as simple as figure out the class being used and find the file containing it. C is much more open ended in where functions are declared and defined. In fact, in Java, there is no differentiation between declaration and definition. The act of defining declares.

  5. #5
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by dayalsoap View Post
    Hi,
    Is there an easy way to find out where the functions are located? Do I need an IDE for this?

    What good IDE can handle a directory-based structure and allows you to find where functions are declared/implemented easily?
    You could probably pull this off quite nicely with Pelles C. The IDE is very complete and it allows you to create project files and workspaces in existing directories, adding files as you need them.

    Even if you don't use the IDE the LIBs, Headers and help file are very complete for both windows and C-99.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to override standard printf defined in gcc library
    By RahulJain83 in forum C Programming
    Replies: 7
    Last Post: 10-27-2009, 10:23 PM
  2. header and source files
    By gtriarhos in forum C Programming
    Replies: 3
    Last Post: 10-02-2005, 04:16 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21