On Fri, 2014-10-17 at 07:46 +0100, Amit Chaudhuri wrote:
> my reading of the manual for GNU make (v3.82) was that a simple
> makefile consisting of:
> 
> main: main.o
> 
> in a project consisting of a single main.cpp file would invoke g++ and
> generate .o from .cpp and main by linking with g++.

That is true.

> This is not what I see and it comes as a surprise.
> 
> The first implicit rule picked up is to link main from main.o with cc
> rather than g++.

If you provide us the output of the make command we can be more helpful.
My suspicion is you have both a "main.c" and a "main.cpp" in your
directory.  Since you don't specify which source file should be used to
build the object file, make uses rule precedence and chooses to build
"main.c".

If you're saying that make is actually compiling 'main.cpp' into
'main.o' and it's using 'cc' as the compiler, I'd say that's not
possible unless there is something else going on that you haven't
described.


_______________________________________________
Help-make mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-make

Reply via email to