【问题标题】:How to build Eclipse C++ project as a library and add it to another project如何将 Eclipse C++ 项目构建为库并将其添加到另一个项目
【发布时间】:2013-05-29 21:34:46
【问题描述】:

我有一个带有一些代码的标准 Eclipse C++ 项目。如何将其编译为静态库并将其作为静态库添加到另一个 Eclipse C++ 项目中?

请给我一步一步的指导。

【问题讨论】:

    标签: c++ static linker


    【解决方案1】:

    制作库:

    文件-->新建-->C++项目-->项目类型-->静态库-->空项目。

    添加库:

    引用文档:

    Q. How do I add a static library file to a project? (Files such as libmtm.a)
    
    A. First you will need to copy the file into your Eclipse project. You can do that by simply dragging it into the project folder in the "Project Explorer" tree in Eclipse. To link the library (A static library is used similarly to an object file):
    
        Open Project, Properties.
        In that dialog select "C++ Build, Settings".
        Under the Tool Settings tab choose "Linker" or "MinGW C Linker" or equivalent and under that select "Libraries".
        Under "Libraries" press the "Add..." button (the green cross) and write the name of the library without the "lib" prefix and ".a" suffix. e.g. in order to link the library file libmtm.a write "mtm".
        Under "Library search path" press the "Add..." button, select workspace and select the project.
    
    猜你喜欢
    • 2014-03-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-02
    • 1970-01-01
    相关资源
    最近更新 更多