I'm trying to learn C++ deeper by reading source of STL as well as debugging it, so I want to link libstdc++
statically to my program, and it works fine using g++
. However, how can I achieve the same thing with clang++
in llvm?
In another way, the question is, what is the clang++
equivalent of -static-libgcc
?
Makefile
I'm using
CXX=g++
CC=g++
LDFLAGS=-g -O0 -static-libgcc
CFLAGS=-O0 -Wall
CXXFLAGS=$(CFLAGS)
The flag you're looking for, in both GCC and Clang, is: -static-libstdc++
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With