Glam Prestige Journal

Bright entertainment trends with youth appeal.

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

2 Answers

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.

1

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.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy