I want to store the errors(result) of a c++ file, when it is compiled.
I thought this code should store the result in the variable var
var=$(g++ file.cpp)
but when I ran this code it returned an empty variable.
Is there any way I can store the result of a c++ file compiling?