Reputation:
I have a bunch of .cpp and .c files and i use gcc/make to build a project. On Mac there is only gcc 4.2. It is very old and puts a lot of limitations on the language. I've heard clang is the default compiler for Mac. How can i change my makefiles to use clang?
Upvotes: 2
Views: 4561
Reputation: 19505
You could try replacing CC=g++ with CC=clang in you makefiles or doing CC=clang make instead of make and see if it compiles.
If you use gnu c/c++ extensions or gcc command line options it may not compile, in that case you can try googling for help.
Upvotes: 2
Reputation: 31339
For starters, GCC 4.2 is not "very old and puts a lot of limitations on the language."
That being said, your Mac, if it has GCC 4.2 installed, should also have clang
installed. Xcode includes both clang and GCC (built with LLVM), as clang
and gcc
/g++
respectively. Either:
clang
directlyCC
environment variable to clang
g++
to clang
if you want to be really hamfisted about it.Any one should do the trick.
Upvotes: 3