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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:06:44+00:00 2026-06-11T12:06:44+00:00

I have to create a factory method which can create objects from different libs.

  • 0

I have to create a factory method which can create objects from different libs. My directory tree looks like this:

libA/src/…
libB/src/…
libC/src/…
src/…

libA, libB, etc are compiled separated.

Let the factory class be in libA/src/Factory.h. It should create an object from libB/src/someclass.h.

If i include ../../libB/src/someclass.h in Factory.h, then libA cant compile, because it can’t find includes from someclass.h (The comiler looks for them in libA/src, but those are in libB/src) If i don’t include, it doesn’t know Someclass, so i can’t create an instance of it.

Is there any solution for this?

  • 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-06-11T12:06:45+00:00Added an answer on June 11, 2026 at 12:06 pm

    You’re looking for forward declaration: in headers where the class only needs to know the type, declare it with class AFactory; instead of including the whole Factory.h.

    See this tip for more info.

    EDIT

    Having re-read your question, I find a contradiction between the fact that you want libraries to be compiled separately, and that factory of libA must know class libB. You can’t compile separately then, so I would simply provide all necessary directories paths to include path.

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

Sidebar

Related Questions

I'm trying to create an EJB factory class, which works like this: You have
I have create a listfragment and a button which looks like as follows (
I have this example FactoryGirl.define do @site = FactoryGirl.create(:my_site) factory :user do email {
Imagine C# code like this ISomeInterface someVar = creator.Create(typeof(SomeClass), typeof(ISomeInterface)); What should happen? Method
I have create a directory uploads in the Content directory and inside the uploads
I have create a vcf file that contains contacts by using this code ContentResolver
I have create name range on sheet A so I need to use this
For years I've been following a great pattern called Target-Action which goes like this:
I am currently trying to create a generic instance factory for which takes an
I hope this isn't too specific. I have created an XML Schema which i

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.