Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhangi47 authored Jul 24, 2023
1 parent c78eabc commit d944238
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Static_Linking/readme
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
Static Linking example

Steps to create static library of two files add.cpp and sub.cpp, Follow below steps in ubuntu.

gcc -c add.cpp -o add.o -- create object file add.o for add.cpp
gcc -c sub.cpp -o sub.o -- create object file sub.o for sub.cpp
ar rcs lib_cal.a add.o sub.o -- create static library lib_cal.a of above object files
gcc -o main main.o -L. lib_cal.a -lstdc++ -- To run the main application based on static library.

./main
output = add :30
sub :10

0 comments on commit d944238

Please sign in to comment.