Jojo Jojo -4 years ago 140
C Question

How to include custom C library

I'm trying to implement a custom library that I found oline. Here is the link:
http://rinkydinkelectronics.com/library.php?id=80

I wanna use some of the functions to help me display the game snake with the chipKIT basic I/O shield for the UNO32 board.

I put the files


  • OLED_I2C.cpp

  • OLED_I2C.h

  • and both files inside OLED_I2C/hardware/PIC32 (since PIC32 is the hardware I have)



into the same directive where my main is. (My main is in a file called project.c)

I then tested if the library works by trying to initialize the display with it, as I've seen in the examples that come with the download. Like so:

(I removed the rest of the program and only kept the relevant parts)

#include <OLED_I2C.h>

OLED myOLED(SDA, SCL, 8);

void setup()
{
myOLED.begin();
}

main
{
setup();
}




But I got the error:

project.c:5:22: ödesdigert fel: OLED_I2C.h: No such file or directory
#include <OLED_I2C.h>
^

(ödesdigert fel = fatal error)


Why can't it find the file, even though I put it in the same directory as my main file?

Could anyone help me understand what I'm doing wrong, or perhaps, what I've gravely misunderstood?

PS. I'm sorry I wasn't able to include library in the tags, but library alone was not an option, and I simply do not know enogh about libraries to tell for sure what type this is.

Answer Source

Change

#include <OLED_I2C.h>

to

#include "OLED_I2C.h"

Angle brackets tell the compiler to look for the file in the system PATH (an environment variable set by the operating system which contains paths to critical binaries/libraries etc). Double quotes refer to files in the current working directory.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download