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

  • SEARCH
  • Home
  • 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 7028413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:23:00+00:00 2026-05-28T00:23:00+00:00

I have the following direcory stucture: src +– lib1 +– lib1.h +– lib2 +–

  • 0

I have the following direcory stucture:

src
  +-- lib1
    +-- lib1.h
  +-- lib2
   +-- lib2.h

Both lib1 and lib2 are gonna be distributed (installed). lib2 makes use of lib1, so it needs some includes:

#include "../lib1/lib1.h" // 1
#include "lib1/lib1.h"    // 2
#include <lib1/lib1.h>    // 3

(1) is the straight forward way, but is very unflexible. (2) is the way I use at the moment, but the build system needs to know that src needs to be added to the include path. (3) seems the best for me under the distribution aspect because then it can be assumed that the headers reside in a standard location, but it’s not too obvious for me how a build system handles that (in this case, lib1 needs to be installed before lib2 can be compiled).

What’s the recommended way?

  • 1 1 Answer
  • 0 Views
  • 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-28T00:23:01+00:00Added an answer on May 28, 2026 at 12:23 am

    The only difference between "" and <> forms of include is that the "" forms first search in some places and then fallback to the same places as <>. The set of additional places is implementation dependent and the only common one is the directory of the file containing the include directive. The compiler options which add to the include path usually add for the <> form and so those directories get searched for both form.

    So the choice between the two forms is mostly a style one. Using the "" form for the current project and the <> one for system libraries is common. For things in between, made a choice and stick to it in your project.

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

Sidebar

Related Questions

Suppose I have the following directory layout in a Maven project: src/ |-- main
I currently have the following directory structure for my code: src |-- main |
I have the following directory structure. root --src ---tests src contains the source &
I have an Eclipse project with the following directory structure: MyProj >> src/main/java >>
I have a Python project with the following directory structure: project/ project/src/ project/src/somecode.py project/src/mypackage/mymodule.py
In my project I have the following structure: src/ plugins/ \__ mpc |__ oper
I have the following directory structure (root) / | \ bin resources src |
I have directory structure like following: analytics / / \ \ conf script src
I have a web application with a following structure: src + main +-+ java
I have a project using autoconf and automake with following structure: / src/ class.h

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.