Reputation: 1343
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)
Upvotes: 6
Views: 4888
Reputation: 3341
The flag you're looking for, in both GCC and Clang, is: -static-libstdc++
Upvotes: 5