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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:40:52+00:00 2026-05-15T13:40:52+00:00

I have the following directory structure. root –src —tests src contains the source &

  • 0

I have the following directory structure.

root
--src
---tests

src contains the source & header files (C files) for the application. When this application is built, it generates an executable. tests directory contains unit test cases (C++ files, using UnitTest++ as testing framework) for the application.

In the testing project, I can include header files from src directory and compile will pass. Problems occur at the link time. Linker won’t be able find the object files in the source directory.

How can I solve this? What is the normal practice in C & C++ projects for having one executable for main application and other one for tests where both needs the same source files to work with?

  • Application type : Cross platform.
  • Current development env : Linux
  • Build tool : CMake

Any help would be great!

  • 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-15T13:40:53+00:00Added an answer on May 15, 2026 at 1:40 pm

    What I’ve always done for this is had three projects. I’d have one build setup which builds a static library, containing most of my code. Then I’d have a test project that links with the static library and a project that contains UI code and such that isn’t typically unit tested.

    Because both projects share the same compiled static library, no recompilation of the files between the projects is necessary.

    • Note: When I say “projects” above, I mean whatever has the scope of a “project” for your build system. For Visual Studio that’s going to be a proj file, for CMake it should be a build target.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following directory structure (root) / | \ bin resources src |
I have an Eclipse project with the following directory structure: MyProj >> src/main/java >>
I have directory with following structure root temp User_related_folder preview1.jpg preview2.jpg preview3.jpg I need
I have currently the following problem. I have a directory structure like root -
I have an .Net MVC 3 web application that has the following structure root
I have the following directory structure on my Apache web root. I would like
I have a project which has the following directory structure. root --include ----module1 ----module2
I have the following structure: Root directory index.php [ mobile ] index.php [images] What
I have this following directory structure Root CommonSchema 1.xsd 2.xsd Service1 XSD 3.xsd (
I have the following directory structure: Main.py A/ __init__.py B/ __init__.py C/ __init__.py The

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.