cout from iterating void function in library

I'm trying to return from a void function (which I might be doing wrong to begin with) from a lbrary being called from the linked main but I get the error: 'c++ no match for operator<< in std::cout' I read up on something about overloading operators but wasn't sure if that was necessary......? From what I understnad, cout does not know how to return an iterator

Below is the source:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
  #include "seq.h"
  #include <stdexcept>
  #include <iostream>

  using namespace std;

  namespace seq
  {
      void mathFuncs::seq(int n){
          for(int i=1; i<=n; i++){
          cout << i << " ";
          }
      }
  }



And here is the main:

1
2
3
4
5
6
7
8
9
10
11
12
  #include <iostream>
  #include "seq.h"
  
  using namespace std;

  int main(){
      int n = 5;

      cout << seq::mathFuncs::seq(n) << endl;

      return 0;
  }


There were other working functions that I ommitted from this example since this was the only one giving me problems.
Last edited on
Was able to use ostream and a vector to finish this one!
Topic archived. No new replies allowed.