posts - 1256, comments - 190, trackbacks - 0, articles - 0
  C++博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

Linking a library to an application

Posted on 2018-11-28 15:12 Prayer 阅读(117) 评论(0)  编辑 收藏 引用 所属分类: LINUX/UNIX/AIX
You can use the same command string to link a static or shared library to your main program. For example:
xlc -o myprogram main.c -Ldirectory  -ltest复制
where directory is the path to the directory containing the library libtest.a.
If your library uses runtime linking, add the -brtl option to the command:
xlc -brtl -o myprogram main.c -Ldirectory -ltest复制

By using the -l option, you instruct the linker to search in the directory specified via the -L option for; if it is not found, the linker searches for libtest.a.

 For additional linkage options, including options that modify the default behavior, see the AIX® ld documentation (

【推荐】超50万行VC++源码: 大型组态工控、电力仿真CAD与GIS源码库
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理