csdccgbdk

Including a static library in a GBDK C project (GBExtended)


I want to use the GBExtended library in my game but I am having difficulty understanding how I would include the library.

I can see that the GBExtended library (at least from the loderunner example source) contains the directories includes/, lib/ and src/ and the file which I need to include is lib/gbext.lib.

I would assume that you would have to include the library in your files as needed:

#include <gbextended/screen.h>
# etc ...

What flags do you have to pass to the lcc compiler so that it will include these libraries? I'm having trouble identifying this from the examples.


Solution

  • With SDCC you can use the -l flag (lowercase L) to specify a library to be included, and the -L flag (uppercase L) to specify the directory from which the files can be found.

    You also have to use -I (uppercase I) to specify where the header files are located.