1

When I compile this I get about 200 lines of compiler errors using MINGW32..I tried to pipe it to a text file using > but no go. But is now calling errors on MINGW32 files.

This code is from this SO Post

and an explanation of the code can be found at this SO Post.

using namespace std;
template <typename Container> ostream& operator<<(ostream& os, const Container& c)  
  {  
  copy(c.begin(), c.end(), ostream_iterator<typename Container::value_type>(os, " "));  
  return os;  
  }
Community
  • 1
  • 1
  • 3
    Did you forget the `#include`s? Don't forget that you need ``, ``, and ``. – Robᵩ Oct 29 '11 at 23:45
  • Please pipe the errors to a file with `2>` and post them. – Dark Falcon Oct 29 '11 at 23:46
  • Sorry basically...I needed to add in and use 2> pipe to read the first few compiler messages...Those 2 items got it done. Thanks...i'll mark it as an answer now so I don't forget. –  Oct 29 '11 at 23:56
  • 2
    Lesson learned: in future please post a **complete**, minimal program that demonstrates the error you are having. If you had posted a complete program, instead of just the program fragment, people would have pointed out the error immediately. See http://sscce.org/. – Robᵩ Oct 30 '11 at 00:05
  • @Rob: You need ``, rather. – Kerrek SB Oct 30 '11 at 00:07
  • @Kerrek. You are right. Chris -- I have posted your results as a community-wiki answer. Feel free to accept that answer. – Robᵩ Oct 30 '11 at 00:10
  • "no go"? What were you trying to accomplish with piping, what was the result, and how did that result differ from what you expected? – Lightness Races in Orbit Oct 30 '11 at 00:34
  • possible duplicate of [operator overloading is breaking functions unexpectantly](http://stackoverflow.com/questions/7942911/operator-overloading-is-breaking-functions-unexpectantly) – Bo Persson Oct 30 '11 at 10:04

1 Answers1

0

1) Don't forget to #include <iterator>.

2) Capture the compiler's standard error stream instead of its standard output. Use 2>.

Robᵩ
  • 163,533
  • 20
  • 239
  • 308