Creating Hello World Program
John Graham
johngavingraham@googlemail.com
Wed May 9 20:38:00 GMT 2012
> I keep getting error messages about unrecognized use of std::cout
By "unrecognized use of" do you really mean "undefined reference to"?
It sounds like you're using gcc when you should be using g++ - or that
you've given the file a .c extension and an IDE/whatever is using gcc
for you because it thinks it should be C, not C++. Is this the
problem? If not, please tell us the command-line/other tool you're
using.
John G
On Wed, May 9, 2012 at 8:31 PM, Patrick Horgan <phorgan1@yahoo.com> wrote:
> On 05/09/2012 12:23 PM, klperez wrote:
>> Hello Everyone,
>>
>> I am sorry if this has been posted somewhere else, but after trying to find
>> this post for over an hour I have given up searching. My problem is with
>> this simple program:
>>
>> ----------------------------------------------------Beginning of
>> Code----------------------------------------------------------
>> #include <iostream>
>> using namespace std;
>>
>> int main()
>> {
>> cout << "Hello World\n";
>> return 0;
>> }
>>
>> ------------------------------------------------------Ending of
>> Code-----------------------------------------------------------
>>
>> I keep getting error messages about unrecognized use of std::cout, which
>> seems like a terrible and misleading bug, because code block seems to
>> recognize cout. When I type the first three letters of cout (cou) it
>> suggests the command "cout" so clearly it recognizes it. Plus, I tested to
>> see if it would suggest cout if I did not include iostream, which it
>> doesn't.
> It sounds like you're using some sort of IDE that is filling stuff in
> for you and building for you? The code as written compiles and runs
> fine with gcc. It's unlikely that you could get gcc to complain about
> that. It's perfectly well written code.
>
> Perhaps if you gave more information about the operating system (mac vs
> windows vs unix/linux), the ide you're using, the gcc version you're
> running, etc., then someone could help.
>>
>> So how can I get rid of this error message? And why is this information not
>> available on GCC's main page? Not having this information available is like
>> having kinder garden teach how to multiple and not teach how to add.
> It's unclear what information you're asking for.
>
> Patrick
>
More information about the Gcc-help
mailing list