Page 1 of 1

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.

Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!

Compilation error
Clear all

Compilation error

2 Posts
2 Users
Joined: 1 second ago
Posts: 0
Topic starter  

Arduino 2.0.4 Code - I am trying to learn to use CAN with Arduino. I downloaded this code to help with my learning curve. But it gives me this Compilation error: "cannot declare variable 'CAN' to be of abstract type 'MCP_CAN'" and highlights the 8th & 14th lines.

Can someone help me?

#include <SPI.h>
#include <mcp_can.h>

const int spiCSPin = 10;
int ledHIGH    = 1;
int ledLOW     = 0;


void setup()

    while (CAN_OK != CAN.begin(CAN_500KBPS))
        Serial.println("CAN BUS init Failed");
    Serial.println("CAN BUS Shield Init OK!");

unsigned char stmp[8] = {ledHIGH, 1, 2, 3, ledLOW, 5, 6, 7};
void loop()
  Serial.println("In loop");
  CAN.sendMsgBuf(0x43, 0, 8, stmp);
This topic was modified 1 month ago by

Famed Member Admin
Joined: 10 years ago
Posts: 2504

My best guess, not knowing this library, or how to use it, is that library may have been updated or changed.
So I did some Google searching and found that this is indeed the case (see this post).
Looks like you can get the latest version here - please note that the developer mentions in his post that some code may need to change. Since you're just starting, I'd assume you're better off playing with their new examples. Hopes this helps!


Like what you see and you'd like to help out? 

The best way to help is of course by assisting others with their questions here in the forum, but you can also help us out in other ways:

- Do your shopping at Amazon, it will not cost you anything extra but may generate a small commission for us,
- send a cup of coffee through PayPal ($5, $10, $20, or custom amount),
- become a Patreon,
- donate BitCoin (BTC), or BitCoinCash (BCH).