To create a static library (.a), you must first execute the command “ar rcs”

You need to add the .a extension of the static library (it’s like a .o extension).

They need to provide you with 2 files:

  • .h (prototype of the functions)
  • .a (implementations) (or packaged in a .a)

The function prototypes must be declared in a .h file.

Perhaps the functions use some kind of defined structure

The directory structure for organizing yourself can be:

  • libs: place the .a files
    • headers: Place the .h file with the function definitions or prototypes
      • structs: Here you can place other .h files that define structs or types that use the function prototypes

In the following image you will see an example

Then, when linking, you must first specify the lib/file.a files, followed by the .o files.

run the executable

Remember that an executable requires a main function; if this function does not exist, it cannot be executable