I wrote some C++ code in Windows. When I run make fileName
from the Visual Studio Code terminal I see the command that make runs is g++ fileName.cpp -o fileName
.
I then compile the same file in macOS Catalina using the same command make fileName
and the command that make runs is c++ fileName.cpp -o fileName
. I have run make -p -f /dev/null
and saw that the CXX variable is set to c++ which is an alias to clang.
I would like make to use g++ on macOS as it does on windows.
I have seen posts mentioning you can change the implicit variables but haven't figured out how to do it. I already changed the default compiler in VS Code from usr/bin/clang to usr/bin/gcc and also tried with usr/bin/g++ but the command doesn't change to g++ fileName.cpp -o fileName
as desired.
I have also tried running CXX=g++
, and CXX='/usr/bin/g++
in the terminal but that didn't work.
Is there a way to do it? I would like to not have to create a makefile in my directory and instead just change the implicit rule.