error running hello world

G

Gary Wessle

thanks for helping with this problem

I am getting errors starting with

fred@debian:~/myPrograms/cpp/practice$ make
cc hello.cpp
/tmp/ccQzQfGH.o: In function `main':
hello.cpp:(.text+0x27): undefined reference to `std::cout'

**************** the program ****************
#include <iostream>
using namespace std;

int main() {
cout << "Hello, World! I am "
<< 8 << " Today!" << endl;
return 0;
}
************************************************

**************** the make file ****************
hello: hello.o
cc hello.cpp
***********************************************
 
I

Ian Collins

Gary said:
thanks for helping with this problem

I am getting errors starting with

fred@debian:~/myPrograms/cpp/practice$ make
cc hello.cpp
/tmp/ccQzQfGH.o: In function `main':
hello.cpp:(.text+0x27): undefined reference to `std::cout'
Try compiling it with a C++ compiler rather an a C compiler.
 
G

Gary Wessle

Ian Collins said:
Try compiling it with a C++ compiler rather an a C compiler.

thanks
it now compiles but when I run it

****************************************************************
fred@debian:~/myPrograms/cpp/practice$ ls
a.out hello.cpp hello.o makefile semantic.cache
fred@debian:~/myPrograms/cpp/practice$ a.out
bash: a.out: command not found
****************************************************************
 
T

Thomas J. Gritzan

Gary said:
thanks
it now compiles but when I run it

****************************************************************
fred@debian:~/myPrograms/cpp/practice$ ls
a.out hello.cpp hello.o makefile semantic.cache
fred@debian:~/myPrograms/cpp/practice$ a.out
bash: a.out: command not found
****************************************************************

The current directory (called ".") is not in your path.

Try:
../a.out

Well, tools and operation systems are offtopic here.
You need to read a good book about Linux.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Hello World Program 1
trouble printing 'Hello World' 8
Strooustrup - Hello World exercise 18
Hello world! 4
error running my project 1
Remove Space, Stuck on lab 1
OUTPUT HELLO 11
Hello world not working on Unix :( 4

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top