google-site-verification: googlebaca44933768a824.html what is going on ?(C++) - Old Royal Hack Forum

Announcement

Collapse
No announcement yet.

what is going on ?(C++)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    what is going on ?(C++)

    #include "stdafx.h"

    int main()
    {
    std::cout << "wtf";
    return 0;
    }

    1>------ Build started: Project: wtf, Configuration: Debug Win32 ------
    1>Compiling...
    1>stdafx.cpp
    1>Compiling...
    1>wtf.cpp
    1>c:\program files\microsoft visual studio 9.0\vc\include\ostream(742) : error C2144: syntax error : 'char' should be preceded by ';'
    1> c:\users\home\documents\visual studio 2008\projects\wtf\wtf\wtf.cpp(10) : see reference to function template instantiation 'std::basic_ostream<_Elem,_Traits> &std::operator <<<std::char_traits<char>>(std::basic_ostream<_Elem,_Traits> &,const char *)' being compiled
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1>Build log was saved at "file://c:\Users\Home\Documents\Visual Studio 2008\Projects\wtf\wtf\Debug\BuildLog.htm"
    1>wtf - 1 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

    #2
    You are not including the right header, cout is defined in <iostream> in the namespace std::!

    Comment


      #3
      I have #include <iostream> in "stdafx.h"

      Comment


        #4
        No, #include <iostream> is to be called in YOUR project, not stdfx(w/e). So it'd be,

        #include <iostream>
        #include stdafx.h

        int main()
        {
        blah

        return 0;
        }

        k?

        EDIT:

        Of couse you can do it this way;

        #include <iostream>

        int main()
        {
        cout << "wtf" << endl;
        return 0;
        }

        //yerp
        Last edited by WaRPiG; 10-28-2009, 05:48 PM.
        <&[myg0t]sp0rk>your little lungs is too small to hotbox with god

        See a Star? Add a Zero, now you can know him.

        Comment


          #5
          no it wont work, I was curious about this:
          c:\program files\microsoft visual studio 9.0\vc\include\ostream(742) : error C2144: syntax error : 'char' should be preceded by ';'

          so I went at c:\program files\microsoft visual studio 9.0\vc\include\ostream and at line 742 it was char _Elem without a ';' , I really dont know how it was manipulated but after I put the ';' after Elem everything is working fine now.
          Thank you for your time anyway ...

          Comment

          Working...
          X