title: ld returned 1 exit status - Windows 8 x64
body: <p>So i'm putting together a program to print the binary representation of different data types and when I got to compile I get these errors</p>
  <hr />
  <blockquote>
  <p>C:\Users\Bryant\AppData\Local\Temp\cckEPS7f.o binaryrepresentation.cpp:(.text+0x133): undefined reference to `printChar(char, std::ostream&amp;)'</p>
  <p>C:\Users\Bryant\AppData\Local\Temp\cckEPS7f.o binaryrepresentation.cpp:(.text+0x16e): undefined reference to `printShort(int, std::ostream&amp;)'</p>
  <p>C:\Users\Bryant\AppData\Local\Temp\cckEPS7f.o binaryrepresentation.cpp:(.text+0x1a7): undefined reference to `printFloat(int, std::ostream&amp;)'</p>
  <p>c:\program files (x86)\dev-cpp\mingw64\x86_64-w64-mingw32\bin\ld.exe  C:\Users\Bryant\AppData\Local\Temp\cckEPS7f.o: bad reloc address 0xc in section `.xdata'</p>
  <p>C:\Users\Bryant\SkyDrive\Documents\Data Structures 2014\collect2.exe  [Error] ld returned 1 exit status</p>
  </blockquote>
  <hr />
  <p>here is my driver</p>
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  #include &quot;display.h&quot;
  
  union FloatValue
  {
  int intView;
  float floatView;
  };
  
  main()
  {
  cout    &lt;&lt; &quot;----------------------------Menu-------------------------&quot; &lt;&lt; endl
          &lt;&lt; &quot; 1 - Print the binary representation of a character&quot; &lt;&lt; endl
          &lt;&lt; &quot; 2 - Print the binary representation of a short integer&quot; &lt;&lt; endl
          &lt;&lt; &quot; 3 - Print the binary representation of a float&quot; &lt;&lt; endl
          &lt;&lt; &quot; 4 - Exit Program&quot;;
          
  cout &lt;&lt; &quot;Enter your selection: &quot;;
  int selection = 0;
  cin &gt;&gt; selection;
          
  while (selection != 4)
  {
      char charInput = '0';
      short int intInput = 0;
      switch(selection)
      {
          case 1: cout &lt;&lt; &quot;\nEnter a character: &quot;;
                  cin &gt;&gt; charInput;
                  printChar(charInput, cout);
                  break;
          case 2: cout &lt;&lt; &quot;\nEnter a short: &quot;;
                  cin &gt;&gt; intInput;
                  printShort(intInput, cout);
                  break;
          case 3: cout &lt;&lt; &quot;\nEnter a short: &quot;;
                  FloatValue num;
                  cin &gt;&gt; num.floatView;
                  printFloat(num.intView, cout);
                  break;
          case 4: break;
      }
      cout &lt;&lt; &quot;\nEnter your selection: &quot;;
      cout    &lt;&lt; &quot;----------------------------Menu-------------------------&quot; &lt;&lt; endl
          &lt;&lt; &quot; 1 - Print the binary representation of a character&quot; &lt;&lt; endl
          &lt;&lt; &quot; 2 - Print the binary representation of a short integer&quot; &lt;&lt; endl
          &lt;&lt; &quot; 3 - Print the binary representation of a float&quot; &lt;&lt; endl
          &lt;&lt; &quot; 4 - Exit Program&quot;;
      cin &gt;&gt; selection;
  }
  </code></pre>
  <p>}</p>
  <hr />
  <p>and here is my header &quot;display.h&quot;</p>
  <pre><code>//          display.h
  
  /*
      Basic operations:
      Print a char
      Print a short int
      Print a float
  */
  #include &lt;iostream&gt;
  
  void printChar(char val, ostream &amp; out);
  /* -----------------------------------
      Prints the binary representation of a user inputed character
  
      Receives: A char value from user
  */
  
  void printShort(int val, ostream &amp; out);
  /* ------------------------------------
      Prints the binary representation of a user inputed integer
  
      Receives: An integer value from user
  */
  
  void printFloat(int val, ostream &amp; out);
  /* ------------------------------------
      Prints the binary representation of a user inputed float
  
      Receives: A float-converted-to-int value from user
  */
  </code></pre>
  <hr />
  <p>When I try to compile me header I get the same errors listed above but when I compile my implementation file I get a different error.</p>
  <p>[Error] iostream: No such file or directory</p>
  <p>here is my implementation file &quot;display.cpp&quot;</p>
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  #include &quot;display.h&quot;
  
  
  // --- Utility Functions
  
  union FloatVal;
  
  // --- Definition of Utility Function-----------------------------------------
  
  union FloatVal
  {
      int intView;
      float floatView;
  };
  
  
  // --- Definition of printChar ----------------------------------------------
  
  void printChar(char val, ostream &amp; out)
  {
  
      int dataSize = sizeof(char)* 8;
      unsigned char mask = 2 ^ (dataSize - 1);
  
      for(int dataSize; dataSize &gt; 0; dataSize--)
      {
          int counter = 0;
          if(counter == 4)
          {
              out &lt;&lt; &quot; &quot;;
              counter = 0;
          };
          if((val &amp; mask) != 0)
          {
              out &lt;&lt; &quot;1&quot;;
          }
  
          else
          {
              out &lt;&lt; &quot;0&quot;;
          };
  
          mask &gt;&gt; 1;
          counter++;
      }
  }
  
  // --- Definition of printShort----------------------------------------------
  
  void printShort(int val, ostream &amp; out)
  {
      int dataSize = sizeof(short int)* 8;
      unsigned int mask = 2 ^ (dataSize - 1);
  
      for(int dataSize; dataSize &gt; 0; dataSize--)
      {
          int counter = 0;
  
          if(counter == 4)
          {
              out &lt;&lt; &quot; &quot;;
              counter = 0;
  
          }
  
          if((val &amp; mask) != 0)
          {
              out &lt;&lt; &quot;1&quot;;
          }
  
          else
          {
              out &lt;&lt; &quot;0&quot;;
          };
  
          mask &gt;&gt; 1;
          counter++;
  
      }
  }
  
  // --- Definition of printFloat-----------------------------------------------
  
  void printFloat(int val, ostream &amp; out)
  {
  
      int dataSize = sizeof(float)* 8;
      unsigned int mask = 2 ^ (dataSize - 1);
  
      for(int dataSize; dataSize &gt; 0; dataSize--)
      {
          int counter = 0;
  
          if(counter == 4)
          {
              out &lt;&lt; &quot; &quot;;
          }
  
          if((val &amp; mask) != 0)
          {
              out &lt;&lt; &quot;1&quot;;
          }
  
          else
          {
              out &lt;&lt; &quot;0&quot;;
          };
  
          mask &gt;&gt; 1;
          counter++;
      }
  }
  </code></pre>
  <p>I tried searching for a solution to the error but almost all of the posts were about linux users, and the ones that were never answered the question.</p>