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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:07:12+00:00 2026-06-18T04:07:12+00:00

I’m using gnu make, and gcc for compiling. I’m on linux (Ubuntu) Here is

  • 0

I’m using gnu make, and gcc for compiling. I’m on linux (Ubuntu)

Here is a diagram for the game black jack where the nodes represent eventual object files.
enter image description here


I have organized the code where each class is in it’s own folder.

tree -d
.
└── classes
    ├── dealer
    │   └── hand
    ├── deck
    │   └── card
    │       ├── card_color
    │       ├── card_suit
    │       ├── card_value
    │       └── colorizer
    ├── discard_pile
    │   └── card
    ├── user
    │   └── hand
    │       └── card
    └── user_choice

In order to make the file-system behave like a graph, some directories are symbolic links.
There is no repeated code.
For example, if the actual card code is in the directory deck, then the hand and discard_pile folders have a symbolic link to that directory in them.


I have run into multiple definition errors, because my program links against all the sub directory object files.
It will follow symbolic links and end up gathering some object files more than once.
I can’t tell it to ignore symbolically linked folders, because sometimes they need to be followed.
For example: if I were to make a driver program in the dealer folder, it would need to gather the hand,card,card_color,card_suit,card_value,colorizer objects (even though the hand folder is a symbolic link).


Is there a way to continue gathering duplicate object files, but to tell gcc or make to ignore the duplicates before linking?
Because they are symbolic links, the path names are different.
Also, there may be instances where objects are named the same, but are different implementations.
I’m not sure how to identify that duplicate object files are indeed the same file and should not be linked more than once.


I don’t want to make this question too general by asking for advice on how to manage big and expanding projects (where entity relationships are complicated), but if you think my structure is nonsensical or problematic, please point out the problems and other ways you would go about it. I was trying to avoid having all my source files in one directory, because without class diagrams, the relationships would be difficult to derive.

  • 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-18T04:07:13+00:00Added an answer on June 18, 2026 at 4:07 am

    Just becuse you USE the same function multiple times in different contexts doesn’t mean you need to link it more than once.

    Your card.cpp needs to go into a common location that can be used by all your different components.

    Typically, a project will have a set of header files, and a set of source files (.cpp or .c for example). When I work on small projects – less than about a dozen source files, I just keep all the files in one directory. But there’s nothing wrong with keeping it a bit more split up. However, a file should only be in one place in the directory structure [!!NO LINKS!!].

    Header files are either with their respective source files, or in a separate “include” directory.

    Typically, source files don’t “care” where the header files are, they are just “somewhere”. Instead you tell the compiler to look for headers in “../some-component” with -I ../some-component.

    And each source file is only compiled and linked once, to form the final binary.

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

Sidebar

Related Questions

I am using JSon response to parse title,date content and thumbnail images and place
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
For some reason, after submitting a string like this Jack’s Spindle from a text
I am using the SimpleRSS gem to parse a WordPress RSS feed. The only
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

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.