Please put a bit more love into C++
Opened this issue · 3 comments
I know you only do C stuff but this build system advertised that it supports C++. On build.prog.mk
I found you are using CC
to link object files. The result is it will fail to link C++ binaries because missing of references to the C++ standard library (libstdc++
or libc++
).
I can't seem to reproduce this on my environment. With clang, libstdc++
gets linked properly if I'm compiling c++.
I'll re-open this issue and double check under different compilers.
With clang,
libstdc++
gets linked properly if I'm compiling c++.
This is not my experience. The clang++
frontend will link libstdc++
/libc++
automatically for you. But the generic frontend, clang
, will not. The same is also true for g++
and gcc
.
OK, I believe my last commit 800aa04 should fix these issues and ensure that CC
is never invoked in place of CXX
based on the presence of C++ source files in ${SRCS}
.
The LINKER_TYPE
setting determines whether the linker is C, C++, Ada or something else. It can be set manually in a Makefile
but the default is to auto-detect. It will now scan for *.cpp
files in ${SRCS}
and the LINKER_TYPE
will default to CXX
if C++ files are present in the sources.
Also, the depend
target now no longer invokes CC
. If ${SRCS}
contains *.cpp
files then make depend
will invoke CXX
with CXXFLAGS
when generating dependencies with the -M
option.
Please feel free to reopen this issue if you think I missed anything. Your feedback is very appreciated :)