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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:57:28+00:00 2026-05-25T14:57:28+00:00

I come from a Java/AS3/Javascript background where all of my classes are organized into

  • 0

I come from a Java/AS3/Javascript background where all of my classes are organized into packages that help denote their functionality.

In starting a C++ project I sought to mimic this file system structure in mostly the same way but I’ve been running into issues with the includes.

Currently I have an src directory with the main.cpp file inside it. Then I have some root directories and with other files inside. Here’s an example:

src

->main.cpp

->window

—->Window.h

—->Window.cpp

main.cpp includes Window.h with the statement #include “Window.h” and everything builds just fine. But if i restart Visual Studio, it complains that it can’t find “Window.h”.

In looking a open source projects, I’ve seen some that just have all the source files in one directory with no nesting for easy includes I suppose. Some have the headers and cpp files separated.

What is the correct way (or at least a way that will cause less headaches) to organize a large-ish C++ project on the file system?

Thanks!

  • 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-25T14:57:29+00:00Added an answer on May 25, 2026 at 2:57 pm

    Breaking it out like you’ve tried to do is reasonable and easy enough to accomplish.

    You just need to set your project’s include paths. From Visual Studio, right click on the project name and click “Properties”. From there, in the tree control on the left hand side, expand “C/C++”, and then select “General” in the tree. The first option on the right hand side should then be “Additional Include Directories”.

    There you have several options:

    You can specify specific include directories (separated by semicolons). For instance, if you had folders “Window” and “Printing” you could put in:

    ..\Window;..\Printing

    Which would allow you to include the files from window and printing easily, like this:

    #include <Window.h>     // from src/window
    #include <Printing.h>   // from src/printing
    

    The above approach has some drawbacks, as you can easily collide with names from other libraries you may be using, making the include ORDER very important.

    A better approach (in my opinion) is to add the following as an include path:

    ..\

    This will make it search the parent directory when looking for includes. This allows you to be more verbose in your include paths, like this:

    #include <Window/Window.h>     // it's more clear where these are coming from
    #include <Printing/Printing.h> // and much less likely to collide with other library
                                   // header files
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I come from a Java background, where packages are used, not namespaces. I'm used
I come from Java background, where we have data structures with interfaces that if
I come from a Java/Eclipse background and I fear that I am spoiled by
I come from Java Background and so used to Debugging using Eclipse but have
I come from a Java background and with any servlets-based technology, it's trivial to
I come from a java background. But I would like a cross-platform perspective on
I come from a Java background and have been using C# for the last
I've come from a java background, so i'm still getting to grips with some
I come from more of a Java background. In the last year or two,
I am new to C++ (just starting). I come from a Java background and

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.