Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am finding it hard to run/compile a simple C++ code in the terminal. Here's the code I am using to compile the file (helloworld.cpp).

g++ helloworld.cpp -o helloworld

I am getting an error. (Image)

enter image description here

share|improve this question
5  
I assume the directory you are currently in contains the file "helloworld.cpp"? :p –  eltommo Apr 27 '12 at 7:49

1 Answer 1

up vote 2 down vote accepted

You need to have the code file (in this case helloworld.cpp) in your current working directory. If the code file is in a different directory, you need to specify where in the command. For example

g++ some/other/folder/helloworld.cpp -o helloworld.o
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.