Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any way to know what version of gcc is used by the make command? I have 5 versions installed of gcc on my computer: by dpkg -l | grep gcc

ii  gcc                                                   4:4.8.2-1ubuntu6                                    i386         GNU C compiler
ii  gcc-4.6                                               4.6.4-6ubuntu2                                      i386         GNU C compiler
ii  gcc-4.6-base:i386                                     4.6.4-6ubuntu2                                      i386         GCC, the GNU Compiler Collection (base package)
ii  gcc-4.8                                               4.8.2-19ubuntu1                                     i386         GNU C compiler
ii  gcc-4.8-base:i386                                     4.8.2-19ubuntu1                                     i386         GCC, the GNU Compiler Collection (base package)
ii  gcc-4.9-base:i386                                     4.9-20140406-0ubuntu1                               i386         GCC, the GNU Compiler Collection (base package)
ii  libgcc-4.8-dev:i386                                   4.8.2-19ubuntu1                                     i386         GCC support library (development files)
ii  libgcc1:i386                                          1:4.9-20140406-0ubuntu1                             i386         GCC support library
share|improve this question

closed as off-topic by Mitch Jul 17 '14 at 17:28

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 4 down vote accepted

Open the terminal and type:

gcc --version
share|improve this answer
how to make sure which [make] use this one – lion Jul 17 '14 at 4:04
@lion karel is telling you, the default version (printed with the command above) is used by make – Lucio Jul 17 '14 at 4:11
+1 ok but how to make sure |: D; – lion Jul 17 '14 at 4:18
You can also explicitly switch from the default version of gcc (aka "auto mode") to a different version of gcc temporarily (manual mode) by following the instructions in this answer. – karel Jul 17 '14 at 4:18
You may also need to check the makefile, some explicitly state a version. – Vality Jul 17 '14 at 13:02

Makefiles often use implicit rules to compile things, rather than defining the compiler specifically. In this case, the convention (and default) is to use $(CC), which defaults to cc. So if you type cc --version, you'll see what Makefiles use by default.

The Makefile may override the definition of CC though, or not use $(CC) at all. But is the convention (as it is within autoconf for configure scripts, too).

Also see:

share|improve this answer

make only does whatever the Makefile tells it to do. Most Makefiles will use the default gcc command, so karel's answer applies in most cases, but you should be aware that there's nothing that forces make to use the default GCC. (And for that matter, make can be used for a lot of things besides compiling C, so it might not even use GCC at all.)

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.