Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Whenever I type in g++ toe.ccp this comes up:

/usr/bin/ld:toe.ccp: file format not recognized; treating as linker script
/usr/bin/ld:toe.ccp:1: syntax error
collect2: ld returned 1 exit status
share|improve this question

It appears you have the wrong file extension. You created a file which you called toe.ccp, however what you want is a file that is toe.cpp (Two p's, not two c's in your file extension). Renaming the file will cause g++ to work correctly.

In case you are unfamiliar with how to do so on the command line, you can do
mv toe.ccp toe.cpp
in the terminal to rename the file. Then try compiling it with g++, it should now work

share|improve this answer
thanks a lot. thats helpful – FukDuk Jun 2 '14 at 20:02
Another option (in case the poster really needs the suffix to be .ccp for some reason) is to declare the source language explicitly using the -x option e.g. g++ -x c++ toe.ccp – steeldriver Jun 2 '14 at 20:03

You should use the correct file extension for the program. toe.ccp is not recognized by GCC as a source file format because of the file extension, so it doesn't know what to do with it. You probably meant to save your file as toe.cpp instead.

As shown in the GCC user manual section on input file names, there are a predefined list of file extensions for each recognized programming language. C++ source files can end in .cc, .cp, .cxx, .cpp, .CPP, .c++, or .C.

share|improve this answer

Your Answer


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.