Code Monkey home page Code Monkey logo

Comments (4)

dascandy avatar dascandy commented on August 17, 2024

You should be able to use the --ignore flag to exclude a tree of files from the analysis. This is typically for build folders, but may be of use in this case too.

I do wonder why it should not be ambiguous? If an include you do have cannot decide between a local include and an imported one, that is still actually ambiguous.

from cpp-dependencies.

jbcoe avatar jbcoe commented on August 17, 2024

Thanks, I'll give that a go. Sounds like a useable workaround.

However, I don't think there's any ambiguity.

#include <catch.hpp>

will only possibly find one header file which is on the include path.

The include path is set to ./externals/catch/include

I'm not sure why cpp-dependencies thinks this is ambiguous.

./externals/catch/include/catch.hpp
./externals/catch/single_include/catch.hpp

are the options it puts forward but the second path is not on any include path (the project I referenced has only one source file).

I'm keen to start using cpp-dependencies as part of our build toolset. Do let me know if I can provide any more useful information.

from cpp-dependencies.

dascandy avatar dascandy commented on August 17, 2024

It finds it ambiguous because you include "catch.hpp" which could be either of those. And it's correct at that - it could be either. Changing your include paths or reordering dependencies could have the result of including the other header with the resulting hidden change in behavior. In this particular case one of them is generated from the other, but in other cases they may be subtly incompatible and result in very hard to find bugs, or cause build instability when adding correct dependencies.

The tool is meant for large code bases, so the issues it finds may seem silly in a small example. Imagine having 100.000 files and unqualified include statements like this that may find one out of three headers depending on where you include it. Suddenly it's very important to have unique includes - not necessarily unique file names, but include statements that can only go to one header.

A concrete way of fixing / avoiding this is to ignore one of the two paths, to get one of the two to change his name, or to include it such that it's obvious which one you include. For example, `#include "single_include/catch.hpp" would not be ambiguous. Given the size of your problem I wouldn't mind it too much.

from cpp-dependencies.

jbcoe avatar jbcoe commented on August 17, 2024

Thanks, that's clear and unambiguous.
We've started using this tool on a much larger code base and already find it very useful.

from cpp-dependencies.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.