Include nested too deeply error

What is the best way of declaring my header files if I want to have the following connections in my C++ code, just so that I don't get the 'include nested too deeply error'? On my edge class, I ...

What is the best way of declaring my header files if I want to have the following connections in my C++ code, just so that I don’t get the ‘include nested too deeply error’?

On my edge class, I have some functions that need to return a Node object. Same for the Edge class, I have functions that need to return a Node object. However the compiler disallow me to have this nested loop thing.

Node.h

#ifndef _NODE_h__
#define __NODE_h__

#include "Edge.h" 
public:
    Node();
    ~Node();
    void setName(string);
    string getName();
    void addEdge(Edge*);
    vector<Edge* > getEdges() { return _edges; };
};
#endif

Edge.h

#ifndef _EDGE_h__
#define __EDGE_h__

#include "Node.h"
class Edge 
{
public:

    Edge();
    Edge(bool);
    ~Edge();
    bool hasBeenSeen() { return _seen; };
    void reset() { _seen = false; };  // resets seen param to false
    Node* getSource() { return _source; };
    Node* getTarget() { return _target; };
    void setSource(Node* source) { _source = source; };
    void setTarget(Node* target) { _target = target; };
};
#endif

Jonathan Leffler's user avatar

asked May 16, 2011 at 18:30

all_by_grace's user avatar

all_by_graceall_by_grace

2,3156 gold badges36 silver badges52 bronze badges

9

As others have suggested, use header guards. But also try forward declaring the classes in question. You may also have to work with pointers (rather than values) in at least one of your classes, but without seeing the code, we can’t tell.

So edge.h should like something like:

#ifndef EDGE_H
#define EDGE_H

class Node;    // forward declaration

Node functionB();

#endif

Note that you will have to define your function in a separate C++ file which then #includes «node.h».

If all this seems very complicated, then you should try simplifying your design. It is probably not necessary for nodes and edges to know about each other — a one way dependency should suffice.

And lastly, names containing double-underscores are reserved in C++ — you are not allowed to create such names in your own code.

Jonathan Leffler's user avatar

answered May 16, 2011 at 18:35

0

Edge.h

#ifndef EDGE_H_INCLUDED
#define EDGE_H_INCLUDED

class Node;

class Edge
{
    int edge_num;
public:
    Edge(int i) : edge_num(i) { };
    Node memberB();
};

#include "Node.h"  

Node Edge::memberB() { Node n(edge_num); return n; }
Node functionB()     { Node n(2);        return n; }

#endif /* EDGE_H_INCLUDED */

Node.h

#ifndef NODE_H_INCLUDED
#define NODE_H_INCLUDED

class Edge;

class Node
{
    int node_num;
public:
    Node(int i) : node_num(i) { };
    Edge memberA();
};

#include "Edge.h"

Edge Node::memberA() { Edge e(node_num); return e; }
Edge functionA()     { Edge e(1);        return e; }

#endif /* NODE_H_INCLUDED */

Note that I have forward declared the classes ‘Edge’ and ‘Node’ before the other header is included, so that by the time the function or member function is defined, the class it returns is also defined.

answered May 16, 2011 at 18:50

Jonathan Leffler's user avatar

Jonathan LefflerJonathan Leffler

718k138 gold badges893 silver badges1260 bronze badges

0

The problem with your include guards is that they don’t match!

You test for _SOMETHING (one underscore) and then if not found you define __SOMETHING (two underscores); these two should match else the include guard does not work!

As others have noted avoid starting things with underscores as those are reserved for libs and OS.

Jonathan Leffler's user avatar

answered May 16, 2011 at 18:56

RedX's user avatar

RedXRedX

14.5k1 gold badge54 silver badges76 bronze badges

3

This is prevented by using either pragma guards or #pragma once (the latter if your compiler supports it).

To use pragma guards, simply do this:

#ifndef SOME_IDENTIFIER
#define SOME_IDENTIFIER

// ... code ...

#endif

Make sure to change SOME_IDENTIFIER for every header file. Usually people make it NAME_OF_HEADER_H; make sure you change both instances of the identifier if you change one.

Also if you do this, make sure any #includes you do are inside the pragma guards.

If you just want to use #pragma once and your compiler supports it, you just have to add

#pragma once

to the top of your header file.

On another note, consider moving the definition of the functions functionA and functionB to their own .cpp files and keeping just the prototype in the .h files, so you don’t get linker errors.

answered May 16, 2011 at 18:32

Seth Carnegie's user avatar

Seth CarnegieSeth Carnegie

73.3k22 gold badges178 silver badges249 bronze badges

1

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 18.04
  • TensorFlow installed from (source or binary): source
  • TensorFlow version: 2.3.0-rc1
  • Bazel version (if compiling from source): 3.1.0
  • GCC/Compiler version (if compiling from source): 7.5.0

Describe the problem
The problem occurs when using libtensorflow_cc.so. When including <tensorflow/core/public/session.h> in the main file of my program that uses libtensorflow_cc.so, it includes <tensorflow/core/framework/tensor.h>, which in turn includes <unsupported/Eigen/CXX11/Tensor>. This file includes itself and results in the error #include nested too deeply.

Provide the exact sequence of commands / steps that you executed before running into the problem
#include <tensorflow/core/public/session.h> in the main file of my program that uses libtensorflow_cc.so.

Any other info / logs

In file included from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1:0,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/tensorflow/core/framework/tensor.h:22,
                 from /media/ssd512/build/tensorflow-prefix/src/tensorflow/tensorflow/core/public/session.h:24,
                 from /media/ssd512/src/main.cpp:2:
/media/ssd512/build/tensorflow-prefix/src/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1:42: error: #include nested too deeply
 #include "unsupported/Eigen/CXX11/Tensor"

1 / 1 / 0

Регистрация: 25.11.2013

Сообщений: 74

1

13.05.2015, 15:41. Показов 3792. Ответов 4


[С++ Fatal Error] string. h(16): F1005 Include files nested too deep

Подскажите пожалуйста, что означает эта ошибка?

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь



1



36 / 36 / 15

Регистрация: 08.12.2014

Сообщений: 171

13.05.2015, 15:51

2

код в студию!



0



19 / 19 / 4

Регистрация: 28.04.2013

Сообщений: 139

14.05.2015, 09:25

3

Не по теме:

Случайно нажал спасибо

Покажите каким образом подключены библиотеки, а лучше весь код



1



SatanaXIII

14.05.2015, 09:37

Не по теме:

Цитата
Сообщение от Access12
Посмотреть сообщение

Случайно нажал спасибо

В таких случаях можно воспользоваться кнопочкой «сообщить модератору» под тем постом, в котором произошло ошибочное нажатие, и описать там суть проблемы. Таким образом спасибка может быть снята.



0



Модератор

8255 / 5477 / 2249

Регистрация: 21.01.2014

Сообщений: 23,578

Записей в блоге: 3

14.05.2015, 10:05

5

Буквальный перевод этой ошибки: «файл вложен слишком глубоко»
У тебя путь к этому самому string.h какой? Не слишком ты его глубоко «зарыл» при установке?



1



 
No such file or directory
This error occurs if GCC cannot find a requested file on its search
path. The file may have been specified on the command-line, or with a
preprocessor #include statement. Either the filename has been
spelled incorrectly or the directory for the file needs to be added to the
include path or link path.
Example:

#include <stdoi.h>  /* incorrect */

int
main (void)
{
  printf ("Hello World!n");
  return 0;
}

The program above tries to include the non-existent file ‘stdoi.h’
giving the error ‘stdoi.h: No such file or directory’. The correct
filename should be ‘stdio.h’.

macro or '#include' recursion too deep
#include nested too deeply
This error occurs if the preprocessor encounters too many nested
‘#include’ directives. It is usually caused by two or more files
trying to include each other, leading to an infinite recursion.
Example:

/* foo.h */
#include "bar.h"
...
/* bar.h */
#include "foo.h"
...

The solution to this problem is to ensure that files do not mutually
include each other, or to use «include guards» (see section 7.4.2 Providing your own templates for an example).

invalid preprocessing directive #...
This error indicates that the preprocessor encountered an unrecognized
# command.
Example:

#if FOO
   int x = 1;
#elsif BAR   /* should be #elif */
   int x = 2;
#else     
   int x = 3;
#endif

The preprocessor syntax requires #elif for the «else if» condition in
#if blocks, rather than #elseif. In the example above
an invalid directive error occurs at the incorrect usage
#elseif, but only when FOO is defined (otherwise the
preprocessor ignores everything up to the #else statement).

warning: This file includes at least one deprecated or antiquated header.
This warning is generated for C++ programs which include old-style
library header files, such as ‘iostream.h’, instead of the modern
C++ library headers without the ‘.h’ extension. The old headers
import their functions into the top-level global namespace, instead of
using the std:: namespace. Note that old-style header files are
still supported, so this message is only a warning and existing programs
will continue to compile. The message is actually generated by a
#warning directive in the old header files, and not by the
preprocessor itself.
Example:

#include <iostream.h>  /* old style */

int
main (void)
{
  cout << "Hello World!n";
  return 0;
}

This program uses an old-style header file ‘iostream.h’. It could
be updated to use #include <iostream> and std::cout
instead.

Ezoic

 

Hi guys I’m a newbie to this side of the bizz, I’m getting this error wile trying to compile my first GameEngine; here is the code that seem to be causing it.

#pragma once

//—————————————————————————
// Include Files
//—————————————————————————
#include <windows.h>
#include «Resource.h»
#include «GameEngine.h»
//—————————————————————————
// Global Variables
//—————————————————————————
GameEngine* _pGame;

Can someone give me a hint?

Thank you very much

ernesto.

The preprocessor can only follow a chain of includes to a certain depth. If one of your .h files in turn includes an .h file that itself includes an .h file, which also includes another .h file, etc., it will only go so deep until it backs out with an error. IIRC, this sort of behavior can also be triggered with an ‘unguarded’ .h file that includes itself. Without guards to force inclusion of the file only once (usually of the #ifndef/#define/#endif variet), you could conceivably get stuck in a chain whereby the file recursively includes itself until the threshold limit is reached.

So, make sure your Resource.h and GameEngine.h files do not include themselves, and check the chain of files they _do_ include to make sure you’re not going over depth.

I think I understand I have 3 .h files, they are as follows GameEngine.h Resource.h and Skeleton.h. 2 of the file they have each other in there, I will play to find out how they should be.

Thank you very much.

Ernesto.

#pragma once

//—————————————————————————
// Include Files
//—————————————————————————
#include <windows.h>
#include «Resource.h»
#include «GameEngine.h»
//—————————————————————————
// Global Variables
//—————————————————————————
GameEngine* _pGame;
=========================================================
//——————————————————————
// Icons Range : 1000 — 1999
//——————————————————————
#define IDI_SKELETON 1000
#define IDI_SKELETON_SM 1001
===========================================================
#pragma once
//—————————————————————————
// Include Files
//—————————————————————————
#include <windows.h>
#include «Resource.h»
#include «GameEngine.h»
//—————————————————————————
// Global Variables
//—————————————————————————
GameEngine* _pGame;

Which compiler are you using? It might not recognize #pragma once. Try putting every header file into #define guards like this:

#ifndef _FILENAMEGOESHERE_#define _FILENAMEGOESHERE_// header file goes here#endif

Don’t rely solely on #pragma once. Always have #ifdef/#define/#endif inclusion guards. #pragma once is just an optimization (the compiler will not reopen the file), and is known to not work properly in some cases — even on compilers that do recognize it.

Why does GameEngine.h include itself?

«Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.»
— Brian W. Kernighan

Thank you let me try that. I’m a total beginner and that is why the error was there. I’m using C++BuilderX.

Let me look at it for a sec.

Thank you.

ernesto.

I don’t understand how to do this? I will need to read some more as it broke all the code. Does C++BuilderX support #pragma I understand that it’s not the best to use but I’m realy lost if I try changing it to ifndef. Could I be a total bother and ask someone to explain how to use ifndef?

Sorry and thank you

Ernesto.

Which compiler are you using? It might not recognize #pragma once. Try putting every header file into #define guards like this:

#ifndef _FILENAMEGOESHERE_
#define _FILENAMEGOESHERE_

// header file goes here
#endif

Quote:Original post by ernestovr
I don’t understand how to do this? I will need to read some more as it broke all the code. Does C++BuilderX support #pragma I understand that it’s not the best to use but I’m realy lost if I try changing it to ifndef. Could I be a total bother and ask someone to explain how to use ifndef?

Sorry and thank you

Ernesto.

Which compiler are you using? It might not recognize #pragma once. Try putting every header file into #define guards like this:

#ifndef _FILENAMEGOESHERE_
#define _FILENAMEGOESHERE_

// header file goes here
#endif

Like so:

in resource.h:
#ifndef _RESOURCE_H_
#define _RESOURCE_H_

<insert code here>

#endif // _RESOURCE_H_

and similar code in GameEngine.h

Try changing your files to look more like this

// The first 2 lines of every .h file should look something // like this (you can change GAMEENGINE_H to a more suitable name tho)#ifndef GAMEENGINE_H#define GAMEENGINE_H//---------------------------------------------------------------------------// Include Files//---------------------------------------------------------------------------#include <windows.h>#include "Resource.h"#include "GameEngine.h"//---------------------------------------------------------------------------// Global Variables//---------------------------------------------------------------------------GameEngine* _pGame;// this is always the last line in your .h file#endif

#ifndef, #endif are called precomiler directives.

#ifndef checks of the name specified is not defined
if it is not, then it allows the compiler to include the whole file. If the name is defined, it jumps to #endif, without including your file.

Thank you very much I will tryied this right now. I have notice that everyone is talking about 2 of the 3 .h files I have but not about the 3rd is there a reason? This is my first time trying it so I created a GameEngine.cpp and .h a Skeleton.cpp and .h and a Resource.rc and .h should I had put the Skeleton and the Resource together? Sorry about the names but as I stated before I’m a total begginer.

Thank you everyone

Ernesto.

Понравилась статья? Поделить с друзьями:
  • Include expects filename or filename error
  • Include error detail postgre
  • Include error detail in the connection string
  • Inassimilable boot device windows 10 как исправить
  • Inaccessible boot device windows 2000 как исправить