How to link libstdc ++ statically with clang ++

I am trying to learn C ++ more deeply by reading the STL source code and also debugging it, so I want to link libstdc++ statically with my program, and it works fine with g++ . However, how can I achieve the same with clang++ in llvm?

A different question arises: what is equivalent to clang++ -static-libgcc ?

Makefile i'm using

 CXX=g++ CC=g++ LDFLAGS=-g -O0 -static-libgcc CFLAGS=-O0 -Wall CXXFLAGS=$(CFLAGS) 
+6
source share
1 answer

The flag you are looking for, both in GCC and in Clang: -static-libstdc++

+3
source

All Articles