unable to compile cpp programs that inlcude cout or cin

Asked by J. Brent Coats

I get the following error when trying to compile a program that contains cout or cin:

in function main:
undefined refrence to 'std::cout'

What am I missing?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu gcc-defaults Edit question
Assignee:
No assignee Edit question
Solved by:
mycae
Solved:
Last query:
Last reply:
Revision history for this message
Best mycae (mycae) said :
#1

Try using g++ rather than gcc, or add -lstdc++ to your compile line.

Your code has compiled fine, it just hasn't linked.

Revision history for this message
J. Brent Coats (jbcoats) said :
#2

Thanks mycae, that solved my question.