title: no match for ‘operator<<’ in ‘os << "Test Failed ["’ when os is an ostream &
body: <p><strong>Edit:</strong> I incorrectly used <code>#include &lt;stdio.h&gt;</code> when I needed to include <code>&lt;iostream&gt;</code>. This happened mostly because I was integrating some C style code with a larger C++ program.</p>
  <p><strong>EndEdit</strong></p>
  <p>I'm  using a simple test framework for my college class, but whenever I use the provided preprocessor macro I get these two errors. I've expanded the macro myself to try and figure out what I'm doing wrong, but I'm stumped.</p>
  <p>errors:</p>
  <blockquote>
  <p>src/Url.cpp: In member function ‘bool Url::Test(std::ostream&amp;)’:</p>
  <p>src/Url.cpp:35: error: no match for ‘operator&lt;&lt;’ in ‘os &lt;&lt; &quot;Test Failed [&quot;’</p>
  <p>src/Url.cpp:35: error: ‘endl’ was not declared in this scope</p>
  </blockquote>
  <p>inc/Url.h</p>
  <pre><code>#ifndef _URL_H
  #define    _URL_H
  
  using namespace std;
  
  class Url {
  public:
      Url();
      Url(const Url&amp; orig);
      virtual ~Url();
      bool Test(ostream &amp; os);
      bool setAsUrl(string relOrRegUrl, string baseUrl);
      bool hasUrl();
      string getUrl();
      bool isHtml();
  
  private:
      string fullUrl;
      bool html;
  
  };
  
  #endif    /* _URL_H */
  </code></pre>
  <p>src/Url.cpp</p>
  <pre><code>#include &lt;string&gt;
  #include &lt;cstring&gt;
  #include &lt;stdio.h&gt;
  #include &quot;UnitTest.h&quot; //This contains the macro
  #include &quot;Url.h&quot;
  
  //using namespace std;
  
  Url::Url() {
      fullUrl = &quot;NULL&quot;;
      html = false;
  }
  
  Url::Url(const Url&amp; orig) {
  }
  
  Url::~Url() {
  }
  
  bool Url::Test(ostream &amp; os) {
  
      bool success = true;
  
      Url url= Url();
      url.setAsUrl(&quot;http://www.cnn.com/news.jpg&quot;,&quot;http://www.cnn.com&quot;);
      do {
          if (!(url.isHtml() == false)) {
              success = false; os &lt;&lt; &quot;Test Failed [&quot; &lt;&lt; __FILE__ &lt;&lt; &quot;, &quot; &lt;&lt; __LINE__ &lt;&lt; &quot;]&quot; &lt;&lt; endl; //line 35
          }
      }while(false);
  //    TEST(url.isHtml() == false); this is what gets expanded to the above
  
      return success;
  }
  
  
  bool Url::setAsUrl(string relOrRegUrl, string baseUrl){
      //Lots of code irrelevant to the question
  }
  
  bool Url::hasUrl(){
      return fullUrl == &quot;NULL&quot;;
  }
  string Url::getUrl(){
      return fullUrl;
  }
  bool Url::isHtml(){
      return html;
  }
  </code></pre>
  <p>Sorry about the long line length, that's what the macro expands to. Oh, and if it helps, what's being passed into Test() is cout as in</p>
  <pre><code>Url url = Url();
  url.Test(std::cout);
  </code></pre>
  <p>So, I'm stumped, and if this seems like a dumb question, sorry. I'm new to C++.</p>