Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 582643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:42:31+00:00 2026-05-13T14:42:31+00:00

I have a project which has the following directory structure. root –include —-module1 —-module2

  • 0

I have a project which has the following directory structure.

root
--include
----module1
----module2
--src
----module1
----module2

So a file say foo.cpp in src/module1 has to include like,

#include "../../include/module1/foo.hpp"

This looks messy and tough to write. I found writing include like

#include <module1/foo.h>

and providing include file search path to root/include when compiling looks neat. However, I am not sure that this style has got any drawbacks.

Which one do you prefer and why? Also do you see any problems in organizing files in the above way?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T14:42:31+00:00Added an answer on May 13, 2026 at 2:42 pm
    #include "../../include/module1/foo.hpp"
    

    Specifying paths should be avoided as much as possible. Compilers provide you with a cleaner alternative to achieve the same. Further, a clean design should see to it that you do not need to juggle relative paths for including headers.

    A better idea of which one to use (including whether to use quotes or the angle-brackets)
    can be had from the standard.

    From my copy of the C++ draft:

    16.2 Source file inclusion

    2 A preprocessing directive of the form

    #include <h-char-sequence> new-line`
    

    searches a sequence of
    implementation-defined places for a
    header identified uniquely by the
    specified sequence between the < and >
    delimiters, and causes the replacement
    of that directive by the entire
    contents of the header. How the places
    are specified or the header identified
    is implementation-defined.

    3 A
    preprocessing directive of the form

    # include "q-char-sequence" new-line 
    

    causes the replacement of that
    directive by the entire contents of
    the source file identified by the
    specified sequence between the ”
    delimiters.
    The named source file is searched for
    in an implementation-defined manner.
    If this search is not supported, or if
    the search fails, the directive is
    reprocessed as if it read

    #include <h-char-sequence> new-line`
    

    with the identical contained sequence
    (including > characters, if any) from
    the original directive.

    7 Although an implementation may provide a mechanism for making
    arbitrary source files available to
    the < > search, in general programmers
    should use the < > form for headers
    provided with the implementation, and
    the ” ” form for sources outside the
    control of the implementation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a project directory which has an .acignore file containing: out/* The project
i have a java ee project which has a text file that uses a
I have a local svn repo on my hard-drive which has directory structure as
I have created a Java application which has the following Apache Ant build file:
I have a project which has some lib's associated with it (in Build Path).
I have a project which has a set of binary dependencies (assembly dlls for
I have a project which has shared functionality between three other projects and have
I have one project which has RIAService with entity framework that is referenced to
ok i have a project which has many gridview in its pages... now i
i have a project table which has a image_id field and a newsimage_id field.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.