Thread: #includes

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    4

    Question #includes

    Does anyone have/know of a program or macro that will go through a project and determine which #includes are unneccesary??

    i.e. it comments them out one by one and makes sure things still compile, if they don't it uncomments them... At then end you have only the necessary #includes and all of the unecessary ones are commented out...

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Lint usually manages this task

    Here are two varieties

    http://lclint.cs.virginia.edu/
    http://www.gimpel.com/lintinfo.htm

  3. #3
    Sayeh
    Guest
    Salem is correct, usually if you have a "smart linker", it only includes those portions of those libraries whose routines are actually called.

    Some lower quality compilers don't link 'smartly' this way. hence 'Hello World!' might generate a 200K object in C++.

  4. #4
    Registered User
    Join Date
    Aug 2001
    Posts
    403

    generally you can do this yourself

    generally you can do this yourself if you dedicate some time to it, the tools salem gave are fine but one costs you a lot of money and the other is pretty strict ANSI-C (no C++). If you simply learn to include files as you need them you can avoid this problem usually though. (unless your project gets really big)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Includes making me insane >.<
    By IceDane in forum C Programming
    Replies: 14
    Last Post: 04-14-2008, 10:24 AM
  2. Makefile and includes
    By Lang in forum C Programming
    Replies: 4
    Last Post: 03-18-2008, 03:29 AM
  3. Avoiding multiple includes
    By plan7 in forum C Programming
    Replies: 5
    Last Post: 11-25-2007, 06:13 AM
  4. added start menu crashes game
    By avgprogamerjoe in forum Game Programming
    Replies: 6
    Last Post: 08-29-2007, 01:30 PM
  5. Circular includes
    By ventolin in forum C++ Programming
    Replies: 2
    Last Post: 05-23-2004, 05:43 PM