How to resolve compilation terminated and g++ : fatal error in cpp on Ubuntu O.S


I wirte the code right why does it show’s me fatal error ?
I think i didn’t miss anything then why my code shows me error where i didn’t do anything wrong ?
And what is the meaning of fatal error why it’s occurres and how solve it ?

The code is

#include <iostream>
using namespace std ;

  // Function call by reference using pointers

  //writing function for swap system

// Call by reference using pointers
void swapPointer(int* a, int* b){ //temp a b
    int temp = *a;          //4   4  5   
    *a = *b;               //4   5  5
    *b = temp;            //4   5  4 

int main(){
    int x =4, y=5;
    cout<<"The value of x is "<<x<<" and the value of y is "<<y<<endl;
    swapPointer(&x, &y);   //This will swap a and b using pointer reference
    cout<<"The value of x is "<<x<<" and the value of y is "<<y<<endl; 
    return 0;

And the error code is 

     cd "/media/sulaiman/P:/03_CPP/FULL_CPP/Fucntion in CPP/" && g++ Call_By_Value_&_Referance.cpp -o Call_By_Value_&_Referance && "/media/sulaiman/P:/03_CPP/FULL_CPP/Fucntion in CPP/"Call_By_Value_&_Referance
[1] 24291
[2] 24292
[3] 24293
g++: error: Call_By_Value_: No such file or directory
g++: fatal error: no input files
compilation terminated.
_Referance: command not found
_Referance.cpp: command not found
_Referance: command not found
[1]   Exit 1                  cd "/media/sulaiman/P:/03_CPP/FULL_CPP/Fucntion in CPP/" && g++ Call_By_Value_
[2]-  Exit 127                _Referance.cpp -o Call_By_Value_
[3]+  Exit 127                _Referance && "/media/sulaiman/P:/03_CPP/FULL_CPP/Fucntion in CPP/"Call_By_Value_

"It's also showing no input file what's it's mean by and if i need to refresh or reset my compiler than how can I do it in ubuntu?"


Don’t put & in file names it confuses things as that character in Unix says to put the command into the background.

Change Call_By_Value_&_Referance.cpp to Call_By_Value_And_Referance.cpp and anywhere else you have them.

Don’t post images, and reformat your question correctly.

Answered By – Bib

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published