MCP2515

#include <stdio.h>
#include <mcp_can.h>
#include <CAN.h>
#include <SPI.h>
#include "mcp_can.h"

#define CAN0_INT 2
MCP_CAN CAN0(10);

void setup() {
   Serial.begin(115200);
  if(CAN0.begin(MCP_ANY, CAN_500KBPS, MCP_16MHZ) == CAN_OK)
    Serial.println("MCP2515 Basarili!");
  else
    Serial.println("MCP2515 Basarisiz!");
  
    pinMode(CAN0_INT, INPUT);
    
  CAN0.setMode(MCP_NORMAL);   
}
void loop() {
  unsigned char len = 0;
  unsigned long canId;
  unsigned char buf[8];
    if(!digitalRead(2)){
      CAN0.readMsgBuf(&canId, &len, buf);
        canId = CAN.getCanId();  
        }     
    }

when I had compiled, last line is erroring. It said, 'class CAN_MCP2515' has no member named 'getCanId'. But I had added libraries. Can you help me?

What board or board/shield are you using? Doesn't the MCP2515 have it's own library?

I using Niren MCP2515 CAN shield. It has not library. I just found to libraries in internet. But When I compiled the library examples, I am getting error again.

Have a look here, seems to be some good information.