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 6085383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:37:58+00:00 2026-05-23T11:37:58+00:00

assume We have c++ project (static)library ‘A’ that uses DirectX headers as precompiled headers

  • 0

assume

We have c++ project (static)library ‘A’ that uses DirectX headers as precompiled headers to implement base graphic engine.

and we have project (static)library ‘B’ that uses ‘A’ headers as precompiled headers to implement game engine

and we have c++ project ‘C’ that uses two previous projects to implement a game

now my question is:

is there any way for project ‘C’ to just include project ‘B’ and do not include (DirectX headers and ‘A’ headers)?

or on the other hand

is there any way to embed (DirectX and project ‘A’) to project ‘B’?

tanks

  • 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-23T11:37:58+00:00Added an answer on May 23, 2026 at 11:37 am

    Precompiled headers should NEVER be exposed to users of a library. They are a detail of the implementation of a library; nothing more. PCHs are something that .cpp files include; they should never be included from a header file.

    Remember: a header file should include only what that header file absolutely needs to in order for it to compile.

    Let’s take your example. Project A uses DirectX. Therefore, the .cpp files in Project A include a PCH that includes the DirectX headers. Now, if the interface to Project A uses DirectX objects and types, then the Project A interface headers (the ones used by users of Project A) will need to include the DirectX headers.

    This will not affect the ability of Project A to use a PCH to improve compile times. The DirectX headers have include guards, so they will not be included multiple times. It costs nothing to include them in the interface headers of Project A.

    Project B, which uses Project A, will have its own PCH files. This PCH will include DirectX and Project A’s headers. Therefore, the inclusion of DirectX in Project A’s headers will not affect the build time of Project B.

    Project B uses Project A. But, as you have described it, Project B does not expose any users of Project B to Project A or DirectX. That is, the fact that Project B uses Project A is an implementation detail of Project B, and therefore it should not be exposed to users of Project B.

    As such, Project B’s interface headers (the headers used by users of Project B) do not include anything from Project A or from DirectX. Therefore, this Project C which uses Project B will not include them.

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

Sidebar

Related Questions

I have a project that uses several static libraries and I keep getting errors
Assume I have a class library project name Utilities.dll as follows: public static class
I have a project which uses strongly typed datasets. Let's assume I want to
Assume I have an ASP.NET MVC app that's not doing anything too fancy (no
OK, so I have a C++ project that compiles to a DLL file. I
Let's assume I have a C# Winforms project, MainGUI. It references another project in
Assume in a winform application we have in program.cs : static class Program {
Let's assume I have two entities - project team and employee. Each employee could
I have a workspace containing 2 projects: A project that has 2 products: a
In a Mixed 3.2.5 iOS/MacOS project, there is an existing iOS static library target,

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.