Skip to content

'operator<<' should be declared prior to the call site #7

Description

@nbro

I was trying to compile this code. First, I do ./configure --prefix=/Users/nbro/Desktop/CPushPush/PUSH_INSTALLATION, so that the installation files will be under that folder PUSH_INSTALLATION. Then I do make and I get the following error

... 
-MF .deps/pushC.Tpo -c ../extension/pushC.cpp  -fno-common -DPIC -o .libs/pushC.o
In file included from ../extension/pushC.cpp:7:
In file included from ../extension/PointExtension.h:21:
./Literal.h:49:12: error: call to function 'operator<<' that is neither visible in the template definition nor found by
      argument-dependent lookup
        os << value;
           ^
./Literal.h:42:5: note: in instantiation of member function 'push::Literal<std::__1::valarray<double> >::to_string'
      requested here
    Literal(T val) : value(val) {}
    ^
../extension/PointExtension.h:91:33: note: in instantiation of member function 'push::Literal<std::__1::valarray<double>
      >::Literal' requested here
                return Code(new Literal< point_t >(val));
                                ^
../extension/PointExtension.h:106:15: note: 'operator<<' should be declared prior to the call site
std::ostream& operator<<(ostream& os, point_t point) {
              ^
1 error generated.
make[2]: *** [pushC.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Any help? It seems that the problem is related to valarray (which is a typedefed to point_t somewhere), which cannot be used with operator<< in Literal.h.

If I do #include "prettyprint.hpp" in Literal.h after having downloaded that source file from here into the src directory, it compiles. Not sure why you didn't encounter this problem before.

However, even after the compilation, if I try to execute the example pushgp_int (or any other the binaries) inside PUSH_INSTALLATION/bin, I get

zsh: segmentation fault  ./pushgp_int

This project seems abandoned, but I guess, if I am wrong, I would appreciate a litlte help.

By the way, I am on a Mac OS (Catalina, version 10.15.7). The version of g++ is Apple clang version 11.0.0 (clang 1100.0.33.8).

I've noticed that the first error and the segfault do not occur on Ubuntu 18.04.3 with g++ 7.5.0. So, this problem seems to be specific to Mac and maybe clang (or even these specific versions of the mac and clang)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions