title: "no match for 'operator<<' (operand types are '__FILE*' {aka '__sFILE64*'} and 'MyObject' ) error C++"
body: <p>Just a typo:</p>
  
  <p>"no match for 'operator&lt;&lt;' (operand types are '__FILE*' {aka '__sFILE64*'} and 'MyObject' ) error when trying to print String or Object in C++" </p>
  
  <p>solved by using cout, not stdout.</p>
  
  <p>but contains Eclipse troubleshooting:</p>
  
  <blockquote>
    <p>(Eclipse) sources.mk not finding and including all subdirectories (Solved) by renaming a folder named headers to r_headers, deleting the sources.mk and refreshing, and then added another folder called a_test. I don't know why it wouldn't work even by closing eclipse before adding another folder, but it magically started finding all subdirectories. (Note: thjis was after using this fix: <a href="https://stackoverflow.com/questions/10373788/how-to-solve-unresolved-inclusion-iostream-in-a-c-file-in-eclipse-cdt#comment59325680_21469917">How to solve &quot;Unresolved inclusion: &lt;iostream&gt;&quot; in a C++ file in Eclipse CDT?</a>)</p>
  </blockquote>
  
  <p>that I didn't see anywhere, and it's just luck I fixed it.</p>
  
  <p>Thank you to those who took the time to point that typo out to me in my tired panic, I appreciate it so much I was too wrapped up in my ide troubles!</p>
  
  <h1>Original</h1>
  
  <p>I am brand new to C++ and I have been fighting with my compiler and IDE set up for 3 days now, I finally have Cygwin and Eclipse building files peacefully without any fatal errors with pathing or makefiles. The builders are: CDT Builder and Scanner Configuration Builder.</p>
  
  <p>That might be relevant because the below code wont compile for my object nor for a string, and even if I replace with:
  <code>stdout &lt;&lt; "hello";</code> directly it still returns
  invalid operands of types '__FILE*' {aka '__sFILE64*'} and 'const char [6]' to binary 'operator&lt;&lt;'</p>
  
  <p>I thought this setup was working because I initialized a hello world file and it ran, but now that there is all my actual code with subdirectories in the src folder, it seems to not work anymore.</p>
  
  <p><strong>What I have tried:</strong></p>
  
  <p>-Had to use VisualStudio for school. It stopped working completely on mylaptop. I was having issues with stdout which causes me to question my code but it seemed to be visual studio having changed the data structure of flags, plus the make files were being a nightmare and couldn't figure out where to put their .o files, so I decided to install eclipse on another computer and see if that was easier.</p>
  
  <p>-installed eclipse for c++ and the vers is:4.14.0</p>
  
  <p>-I updated cygwin gcc,gnu,debug &amp; etc to latest versions</p>
  
  <p>-enabled auto refresh in general properties
  -I fixed sources.mk not including subdirectories by renaming a headers folder to r_headers, deleted the sources.mk and refreshed a lot, and then added another folder called a_test. I don't know why it wouldn't work before adding another folder, but it magically started finding all subdirectories.</p>
  
  <p>-in my includes file it looks to me like everything necessary is included (Windows 10 64 bit)
   c:/cygwin64/usr/(include/, include/w32api)
   c:/cygwin64/lib/gcc/.../ (include,c++,c++/backward,c++/x86_64-pc-cygwin)</p>
  
  <p>The relevant MyObject snippets </p>
  
  <p>(the code itself is more complicated, this is purely made up snippets, but I just want to know if the error lies somewhere really simple and I am just not getting something very basic!)</p>
  
  <p><strong>MyObject.h</strong></p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  using std::string;
  
  class MyObject {
  private:
      string s1;
      string s2;
  public:
      MyObject();
      std::ostream&amp; operator&lt;&lt;(std::ostream&amp; os,MyObject const&amp; o);
      string toString();
  };
  
  </code></pre>
  
  <p><strong>MyObject.cpp</strong></p>
  
  <pre><code>class MyObject{
      string s1,s2;
      MyObject(){
         s1 = "hello";
         s2 = "world";
   }
  };
  
  std::ostream&amp; operator&lt;&lt;(std::iostream&amp; os, MyObject const&amp; o) {
      string s = toString();
      os &lt;&lt; s;
      return os;
  }
  
  string toString() {
      return s1+s2;
  }
  
  </code></pre>
  
  <p><strong>main.cpp</strong></p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  
  #include "../r_headers/MyObject.h"
  
  using std::string;
  using std::cout;
  using std::endl;
  
  void test_print_mo() {
      MyObject o = MyObject();
      //string s= MyObject.toString();
      //stdout &lt;&lt; o; **// where I initially made a typo** 
      cout &lt;&lt; o; //works, solution
  
  }
  int main() {
  
      test_print_mo();
  
      //do not delete, make sure window doesn't close
      cin.get();
      return 0; //for compiler
  
  }
  
  </code></pre>
  
  <p>Thank you very much, these past few days have been so unproductive because I just cant get anything to work properly!</p>