0

When I run the command gcc CCC.Cpp I get this error:

CCC.Cpp: file not recognized: file format not recognized
Collect2: error: ld returned 1 exit status"

This is the content of CCC.Cpp file:

#include <iostream>
using namespace std;
int main(){cout << "CCC";return 0;}

Error message

Lorenz Keel
  • 8,905
CCC019
  • 1

1 Answers1

1

You have to rename the file from CCC.Cpp to CCC.cpp first and then compile your application by G++ (C++ compiler).

Reproducible way:

sudo apt-get install g++

mv CCC.Cpp CCC.cpp g++ CCC.cpp -o CCC ./CCC

Also you should not use root account for daily non-administrative task.

N0rbert
  • 99,918
  • After installing g++ and renaming the source file, you can use just make CCC instead of the g++ ... command. – FedKad Jul 07 '21 at 09:47