Skip to content

Conflicting definition for the type "byte" in "src/fncs.cpp" #28

@chandrakishorSingh

Description

@chandrakishorSingh

I have successfully installed zmq and was trying to install fncs.

I used the following command to compile fncs.

./configure --prefix=$FNCS_INSTALL --with-zmq=$FNCS_INSTALL

It compiled successfully. Then I tried to build the program using make as follows.

make

But it gave me the following error.

make  all-am
make[1]: Entering directory '/home/chandrakishor/fncs'
  CXX      src/fncs.lo
In file included from ./contrib/yaml-cpp/include/yaml-cpp/yaml.h:8,
                 from src/fncs.cpp:36:
./contrib/yaml-cpp/include/yaml-cpp/parser.h:46:22: warning: ‘template<class> class std::auto_ptr’ is deprecated: use 'std::unique_ptr' instead [-Wdeprecated-declarations]
   46 |                 std::auto_ptr<Scanner> m_pScanner;
      |                      ^~~~~~~~
In file included from /usr/include/c++/11/memory:76,
                 from ./contrib/yaml-cpp/include/yaml-cpp/parser.h:12,
                 from ./contrib/yaml-cpp/include/yaml-cpp/yaml.h:8,
                 from src/fncs.cpp:36:
/usr/include/c++/11/bits/unique_ptr.h:57:28: note: declared here
   57 |   template<typename> class auto_ptr;
      |                            ^~~~~~~~
In file included from ./contrib/yaml-cpp/include/yaml-cpp/yaml.h:8,
                 from src/fncs.cpp:36:
./contrib/yaml-cpp/include/yaml-cpp/parser.h:47:22: warning: ‘template<class> class std::auto_ptr’ is deprecated: use 'std::unique_ptr' instead [-Wdeprecated-declarations]
   47 |                 std::auto_ptr<Directives> m_pDirectives;
      |                      ^~~~~~~~
In file included from /usr/include/c++/11/memory:76,
                 from ./contrib/yaml-cpp/include/yaml-cpp/parser.h:12,
                 from ./contrib/yaml-cpp/include/yaml-cpp/yaml.h:8,
                 from src/fncs.cpp:36:
/usr/include/c++/11/bits/unique_ptr.h:57:28: note: declared here
   57 |   template<typename> class auto_ptr;
      |                            ^~~~~~~~
In file included from ./contrib/yaml-cpp/include/yaml-cpp/yaml.h:9,
                 from src/fncs.cpp:36:
./contrib/yaml-cpp/include/yaml-cpp/emitter.h:105:22: warning: ‘template<class> class std::auto_ptr’ is deprecated: use 'std::unique_ptr' instead [-Wdeprecated-declarations]
  105 |                 std::auto_ptr <EmitterState> m_pState;
      |                      ^~~~~~~~
In file included from /usr/include/c++/11/memory:76,
                 from ./contrib/yaml-cpp/include/yaml-cpp/parser.h:12,
                 from ./contrib/yaml-cpp/include/yaml-cpp/yaml.h:8,
                 from src/fncs.cpp:36:
/usr/include/c++/11/bits/unique_ptr.h:57:28: note: declared here
   57 |   template<typename> class auto_ptr;
      |                            ^~~~~~~~
In file included from ./contrib/yaml-cpp/include/yaml-cpp/node.h:14,
                 from ./contrib/yaml-cpp/include/yaml-cpp/yaml.h:13,
                 from src/fncs.cpp:36:
./contrib/yaml-cpp/include/yaml-cpp/iterator.h:20:31: warning: ‘template<class> class std::auto_ptr’ is deprecated: use 'std::unique_ptr' instead [-Wdeprecated-declarations]
   20 |                 Iterator(std::auto_ptr<IterPriv> pData);
      |                               ^~~~~~~~
In file included from /usr/include/c++/11/memory:76,
                 from ./contrib/yaml-cpp/include/yaml-cpp/parser.h:12,
                 from ./contrib/yaml-cpp/include/yaml-cpp/yaml.h:8,
                 from src/fncs.cpp:36:
/usr/include/c++/11/bits/unique_ptr.h:57:28: note: declared here
   57 |   template<typename> class auto_ptr;
      |                            ^~~~~~~~
In file included from ./contrib/yaml-cpp/include/yaml-cpp/node.h:14,
                 from ./contrib/yaml-cpp/include/yaml-cpp/yaml.h:13,
                 from src/fncs.cpp:36:
./contrib/yaml-cpp/include/yaml-cpp/iterator.h:36:22: warning: ‘template<class> class std::auto_ptr’ is deprecated: use 'std::unique_ptr' instead [-Wdeprecated-declarations]
   36 |                 std::auto_ptr<IterPriv> m_pData;
      |                      ^~~~~~~~
In file included from /usr/include/c++/11/memory:76,
                 from ./contrib/yaml-cpp/include/yaml-cpp/parser.h:12,
                 from ./contrib/yaml-cpp/include/yaml-cpp/yaml.h:8,
                 from src/fncs.cpp:36:
/usr/include/c++/11/bits/unique_ptr.h:57:28: note: declared here
   57 |   template<typename> class auto_ptr;
      |                            ^~~~~~~~
In file included from ./contrib/yaml-cpp/include/yaml-cpp/yaml.h:13,
                 from src/fncs.cpp:36:
./contrib/yaml-cpp/include/yaml-cpp/node.h:43:22: warning: ‘template<class> class std::auto_ptr’ is deprecated: use 'std::unique_ptr' instead [-Wdeprecated-declarations]
   43 |                 std::auto_ptr<Node> Clone() const;
      |                      ^~~~~~~~
In file included from /usr/include/c++/11/memory:76,
                 from ./contrib/yaml-cpp/include/yaml-cpp/parser.h:12,
                 from ./contrib/yaml-cpp/include/yaml-cpp/yaml.h:8,
                 from src/fncs.cpp:36:
/usr/include/c++/11/bits/unique_ptr.h:57:28: note: declared here
   57 |   template<typename> class auto_ptr;
      |                            ^~~~~~~~
In file included from ./contrib/yaml-cpp/include/yaml-cpp/yaml.h:13,
                 from src/fncs.cpp:36:
./contrib/yaml-cpp/include/yaml-cpp/node.h:117:22: warning: ‘template<class> class std::auto_ptr’ is deprecated: use 'std::unique_ptr' instead [-Wdeprecated-declarations]
  117 |                 std::auto_ptr<NodeOwnership> m_pOwnership;
      |                      ^~~~~~~~
In file included from /usr/include/c++/11/memory:76,
                 from ./contrib/yaml-cpp/include/yaml-cpp/parser.h:12,
                 from ./contrib/yaml-cpp/include/yaml-cpp/yaml.h:8,
                 from src/fncs.cpp:36:
/usr/include/c++/11/bits/unique_ptr.h:57:28: note: declared here
   57 |   template<typename> class auto_ptr;
      |                            ^~~~~~~~
src/fncs.cpp: In function ‘std::ostream& operator<<(std::ostream&, zframe_t*)’:
src/fncs.cpp:970:5: error: reference to ‘byte’ is ambiguous
  970 |     byte *data = zframe_data (self);
      |     ^~~~
In file included from /usr/include/c++/11/bits/stl_algobase.h:61,
                 from /usr/include/c++/11/algorithm:61,
                 from src/fncs.cpp:5:
/usr/include/c++/11/bits/cpp_type_traits.h:404:30: note: candidates are: ‘enum class std::byte’
  404 |   enum class byte : unsigned char;
      |                              ^~~~
In file included from /home/chandrakishor/FNCS-install/include/czmq.h:19,
                 from src/fncs.cpp:33:
/home/chandrakishor/FNCS-install/include/czmq_prelude.h:381:25: note:                 ‘typedef unsigned char byte’
  381 | typedef unsigned char   byte;           //  Single unsigned byte = 8 bits
      |                         ^~~~
src/fncs.cpp:977:18: error: invalid types ‘<unresolved overloaded function type>[uint {aka unsigned int}]’ for array subscript
  977 |         if (data [char_nbr] < 9 || data [char_nbr] > 127)
      |                  ^
src/fncs.cpp:977:41: error: invalid types ‘<unresolved overloaded function type>[uint {aka unsigned int}]’ for array subscript
  977 |         if (data [char_nbr] < 9 || data [char_nbr] > 127)
      |                                         ^
src/fncs.cpp:986:77: error: invalid types ‘<unresolved overloaded function type>[uint {aka unsigned int}]’ for array subscript
  986 |             sprintf (buffer + strlen (buffer), "%02X", (unsigned char) data [char_nbr]);
      |                                                                             ^
src/fncs.cpp:988:59: error: invalid types ‘<unresolved overloaded function type>[uint {aka unsigned int}]’ for array subscript
  988 |             sprintf (buffer + strlen (buffer), "%c", data [char_nbr]);
      |                                                           ^
make[1]: *** [Makefile:990: src/fncs.lo] Error 1
make[1]: Leaving directory '/home/chandrakishor/fncs'
make: *** [Makefile:576: all] Error 2

It seems there are 2 definitions of the type "byte". One is present in /usr/include/c++/11/bits/cpp_type_traits.h which I'm assuming is a file from the g++ compiler. And the other is present in /home/chandrakishor/FNCS-install/include/czmq_prelude.h.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions