-1

So I have the following file structure:

  • Graphics (folder)
    • RenderCore.h
    • RenderCore.cpp
  • MainProject (Folder)
    • app.h
    • app.cpp
  • Water (Folder)
    • WaterRenderer.h
    • WaterRenderer.cpp

I can use #include <Graphics/RenderCore.h> from WaterRenderer.h, or from any other header file in any other folder in the project. Except for app.h.

For some reason, when I try to use #include <Graphics/RenderCore.h> or #include <RenderCore.h>, I get an error message, telling that the file doesn't exist.

The same goes for any other header file in any other folder, if I try to import it into app.h.

But, if I move app.h and app.cpp into a different folder, I can use the above-mentioned includes, but I can't start the program, because it asks me to "Select a valid startup file".

Does anyone know a possible solution or at least a cause? I'm using VisualStudio 2019 on Windows 10.

πάντα ῥεῖ
  • 1
  • 13
  • 116
  • 190
  • 5
    [Where does Visual Studio look for C++ header files?](https://stackoverflow.com/a/335426) – 001 Jan 21 '21 at 20:58
  • 1
    Did you read the documentation of your compiler? In many cases, that documentation is available in printed books.... or printed on paper. Or perhaps read your courses again. – Basile Starynkevitch Jan 21 '21 at 20:59
  • 1
    I miss the old days when stuff shipped with the manual. First DOS manual I got was a set of massive three ring binders. The next one was a three or four hundred page tome. Then a fifty to sixty page book. By windows all I got was a folded pamphlet that spent more time informing me that if a bug in the software caused the computer to spring to life and murder my children, Microsoft wasn't responsible. Even if their testing showed that it would happen. From solid technical information to nothing but ass-covering in about ten years. Today you don't even get the pamphlet. – user4581301 Jan 21 '21 at 21:08
  • 1
    Only explanation I can think of is that you've set some file specific settings for app.cpp – john Jan 21 '21 at 21:10
  • @JohnnyMopp I did that... Vs doesn't underline the include lines red anymore, but when trying to build it says the specified include file doesn't exist. – JustASomebody Jan 21 '21 at 21:13

1 Answers1

0

There are two methods to include header files.

  1. Add the full path directly to the head of the source program

    #include "D:\testfolder\Graphics\RenderCore.h"

  2. Properties->VC++->Include Directories->add the path

Note: Solution Configuration settings need to be consistent with the settings on the Properties

enter image description here enter image description here

Barrnet Chou
  • 1,738
  • 1
  • 4
  • 7