- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi friends,
I have compiled some C++ files in Linux, and so I have the object files ready. But my goal is to link them into a library file (like a DLL or LIB file in windows). In windows I did it via VS2008 and by creating a library-type project. But in linux, I have no idea how I can do it via command lines. I am using intel C++ V11.1 (x64). Please help me solve the problem.
Thank you,
Hamidreza,
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
Easy,
require to use ar and ranlib for create lib.
after you add flag to call lib at instruction compiler.
compiler -c yoursource.c ??.c ??.c ??.c ??.c ext.... (result .o)
ar yourlib.a precedent_result.o (result .a)
ranlib yourlibresult.a (for index)
(after require also your inform path header -I , path Lib -L -l your newlib (flag compiler)
better that you use same compiler two but not obligated
Regards
I forget....
add an dummy link .SO to .a (ln) for after it could be compile as shared
Easy,
require to use ar and ranlib for create lib.
after you add flag to call lib at instruction compiler.
compiler -c yoursource.c ??.c ??.c ??.c ??.c ext.... (result .o)
ar yourlib.a precedent_result.o (result .a)
ranlib yourlibresult.a (for index)
(after require also your inform path header -I , path Lib -L -l your newlib (flag compiler)
better that you use same compiler two but not obligated
Regards
I forget....
add an dummy link .SO to .a (ln) for after it could be compile as shared
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The stock linux method with ar and ranlib is the one to use with .o files made without -ipo. This is recommended as your first step. The xiar tool which comes with icc is capable of dealing with ipo objects.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page