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.

Attempting to do some compiling with g++ and when I run g++ test.cpp this is what I get. I am in the correct directory and I have even messed with the permission settings to make those directories chmod 777 as a test, still nothing. Tried running it as sudo g++ test.cpp and getting nothing. It can compile and create a .o if i run g++ -c test.cpp but it can't seem to link it and create the .out. Any suggestions?

/usr/bin/ld: 1: /usr/bin/ld: /bin: Permission denied 
/usr/bin/ld: 2: /usr/bin/ld: test.cpp: not found
/usr/bin/ld: 3: /usr/bin/ld: test.cpp: not found
/usr/bin/ld: 4: /usr/bin/ld: test.cpp: not found
/usr/bin/ld: 5: /usr/bin/ld: test.cpp: not found
/usr/bin/ld: 6: /usr/bin/ld: test.cpp: not found
/usr/bin/ld: 7: /usr/bin/ld: test.cpp: not found
/usr/bin/ld: 8: /usr/bin/ld: test.cpp: not found
/usr/bin/ld: 9: /usr/bin/ld: test.cpp: not found
/usr/bin/ld: 10: /usr/bin/ld: test.cpp: not found
/usr/bin/ld: 11: /usr/bin/ld: test.cpp: not found
/usr/bin/ld: 12: /usr/bin/ld: Syntax error: "(" unexpected collect2: ld returned 2 exit status
share|improve this question
what is your current working directory? and what command you used? –  Deepak Oct 10 '12 at 8:15
this probably won't help, but try (re)installing build-essential package –  Salem Oct 10 '12 at 12:20
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer


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

Browse other questions tagged or ask your own question.