Cesar Mello's notes
Friday, April 28, 2017
How to static link C and C++ runtimes in gcc 6.2
For C:
gcc -o main Main.c -O2 -static-libgcc -static
For C++:
g++ -o main Main.cpp -O2 -static-libgcc -static-libstdc++ -static
To make sure it worked:
ldd main
should not display any dependencies.
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment