-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c78eabc
commit d944238
Showing
1 changed file
with
12 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|