) Hi Guys, I am working now in a project that is placed into my docs\visual studio proj, that need to use . h files, placesd in c:\prog files\windows sdk and c:\prog files\OpenCv. Into these directories have another subdirectories with these .h that into them are included others .h files too. I was defined in the compiler into tool-->options the paths for these files but till now don't find some of them, or give me a message that a file is twice. PLS, Can sambody tell me what is the better way to distribute the files in a project like this, to solve this inconvenient ?

2) The second question is that I see in the main cpp file #include ----.h . Some of them appear in the solution explorer window, in her tree representation and some of them not, that mean that must look for them outside, it is rigth?
I tried to put some of them that aren't and give me a message that are twice, how to solve this issue?

Thanks Guys , wait for me and I will answer your dubts too.........Thanks again !

Dani AI

Generated

Quick summary and practical path forward: treat third‑party headers as external dependencies and do not copy them into the project source tree. Reference them from the project via per‑project include settings or a shared property sheet so the compiler sees one canonical location for each header. Keep libraries and headers grouped under a single repo folder (for example a top‑level third_party/include and third_party/lib) or manage them with a package manager so paths remain consistent across machines.

Why some includes appear in Solution Explorer while others do not: Solution Explorer shows files that were explicitly added to the project. Headers that the compiler finds via include paths are not automatically listed. Adding external headers into the project is usually unnecessary and can create confusion or apparent “duplicates” in the UI without changing how the compiler resolves includes.

Common causes of “file twice” or duplicate‑definition problems and how to fix them:

  • Two different copies of a header exist on disk and both are reachable from include paths. Locate duplicate filenames and remove or consolidate them.
  • A header contains non‑inline function or global variable definitions; when included in multiple translation units this produces linker errors. Move definitions into .cpp files or mark small functions/variables inline/constexpr.
  • Missing include guards allow multiple expansion inside a single translation unit.

Use these debugging steps:

  • Enable the compiler’s include trace to see exactly which file is being picked and from which directory.
  • Check the project’s Additional Include Directories / shared property sheet to remove redundant entries and control include order.
  • Add proper include guards, for example:
#ifndef MYLIB_HEADER_H
#define MYLIB_HEADER_H

/* declarations only — no non-inline definitions */

#endif /* MYLIB_HEADER_H */

As pointed out, IDE include settings are part of the solution; prefer per‑project settings or shared property sheets rather than ad‑hoc copying. The symptoms described most often trace to duplicate files on disk or definitions in headers rather than a mysterious IDE bug.

If you want to reference header files in all your projects then select Tools -->Options --> Projects And Solutions --> C++ Directories, then add the paths in the window on the right side of the screen. After that all you have to do is something like #include <dm/something.h> if the header is in the dm subdirectory. You have to know what folder the header file is in because the compiler won't search subdirectories for you.


I don't know about your second question because I never look at those files. When I want to see an include file I just right click on the #include <...h> line and select Open Document from the popup window.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.