OT: C++ Question, solved
Karl F. Larsen
klarsen1 at gmail.com
Thu Mar 12 21:34:34 UTC 2009
> Karl Larsen wrote:
>> karl at cheap-laptop:~/cplus$ g++ ex75.c
>> ex75.c: In function ‘int main()’:
>> ex75.c:24: error: no match for ‘operator<<’ in ‘std::cin << feet’
>> karl at cheap-laptop:~/cplus$
>> As you can see the little c++ example from the book does not compile. I
>> added the (line 24) so you readers can see what line the g++ compiler
>> see's an error. I simply can't see the error and so need some help.
>> Your welcome to try it on your Linux and I hope you do.
> statement should be:
> cn >> feet ...
> Moreover, your example you gave about does not compile anyway. I get:
> $> g++ -Wall foo.c -o foo
> foo.c: In function ‘int main()’:
> foo.c:19: error: ‘line’ was not declared in this scope
> foo.c:19: error: expected `)' before numeric constant
> Fix that. Try again.
> Advice: use the usual c++ source code file extensions for c++ source
> code (cc, cpp, c++, etc.).
Hi and thanks for your work. I will use .cc from now on, if the joe
editor will do color with that. The color helps me.
I fixed the source code by erasing the entire line:
and then retyping it in.
I find c++ a whole lot more unforgiving of typing gliches. I need to
believe what g++ gives as an error and just retype it right away.
Karl F. Larsen, AKA K5DI
PGP 4208 4D6E 595F 22B9 FF1C ECB6 4A3C 2C54 FE23 53A7
More information about the ubuntu-users