How do I create a library?

后端 未结 5 951
甜味超标
甜味超标 2020-12-22 22:54

Let\'s say I have 10 *.hpp and *.cpp files that I need to compile a code. I know that I will need those same files for many different codes. Can I create a \"package\" with

5条回答
  •  甜味超标
    2020-12-22 23:31

    On Linux:

    g++ FLAGS -shared -Wl,-soname,libLIBNAME.so.1 -o libLIBNAME.VERSION OBJECT_FILES

    where

    FLAGS: typical flags (e.g., -g, -Wall, -Wextra, etc.)

    LIBNAME: name of your library

    OBJECT_FILES: objects files resulting from compiling cpp files

    VERSION: version of your library

提交回复
热议问题