CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2009
    Location
    France
    Posts
    2,513

    Include everywhere

    I created a common.h file that includes a bunch of very basic macros like UInt, SInt etc...

    I would like this file to be included into each and everyone of my files in my project, no questions asked.

    I've never configured a project before, and I'm using CodeBlocks IDE on a windows machine. I'm not entirely sure at how to go about things.

    Is it possible to include files by default? Is it a smart idea to it, or is it "better" to add it by hand manually everywhere?

  2. #2
    Join Date
    Jan 2006
    Location
    Belo Horizonte, Brazil
    Posts
    405

    Re: Include everywhere

    If you have too many files you might consider creating a script that writes the include line for you. Otherwise, I would do it manually.

    I would like this file to be included into each and everyone of my files ...
    Are you going to include that file even in your header files? This will increase dependencies in your source. When you edit this particular file, basically your whole application will need to be recompiled.

    Depending on the contents of this header, precompiled headers can be useful.

  3. #3
    Join Date
    Jun 2009
    Location
    France
    Posts
    2,513

    Re: Include everywhere

    Quote Originally Posted by ltcmelo View Post
    If you have too many files you might consider creating a script that writes the include line for you. Otherwise, I would do it manually.



    Are you going to include that file even in your header files? This will increase dependencies in your source. When you edit this particular file, basically your whole application will need to be recompiled.

    Depending on the contents of this header, precompiled headers can be useful.
    Well the file shouldn't change too often. As I said, it will only contain typedefs for things like "typedef unsigned int UInt;"

    But it needs to be included everywhere, because I will be using those typedefs. I'll look into precompiled headers, they seem interesting. But my project is not so big as for compilation times to be a concern.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured